摘要: const int num = 5;, 使num成为一个常量,无法改变 const int* p = new int; const 放在星号前面,无法改变a指向的值,倒着读或理解为const修饰 *p,所以指针指向变量不能变 int* const p = new int; const 放在星号后面, 阅读全文
posted @ 2022-06-22 22:31 道友请留步W 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 函数中的静态变量(初始化一次,后续进入函数不再进行重置) static 在类或者机构体中,只被初始化一次,因为它们在单独的静态存储中分配了空间,因此类中的静态变量由对象共享。对于不同的对象,不能有相同静态变量的多个副本。因为这个原因,静态变量不能使用构造函数初始化 类中的静态成员函数 :静态成员函数 阅读全文
posted @ 2022-06-22 22:12 道友请留步W 阅读(46) 评论(0) 推荐(0) 编辑
摘要: import logging import logging.handlers import multiprocessing import multiprocessing.pool from random import choice, random import time class ProcessL 阅读全文
posted @ 2022-05-25 08:47 道友请留步W 阅读(42) 评论(0) 推荐(0) 编辑
摘要: import types class B: def __init__(self, x, y): self.x = x self.y = y def foo(self): pass def A(self): print(self.x) print("A function...") if __name_ 阅读全文
posted @ 2022-05-07 08:58 道友请留步W 阅读(52) 评论(0) 推荐(0) 编辑
摘要: ''' 栈 实现语言: Python 有次序的数据集, 每个数据仅从栈顶一端加入和从数据集中移除 ''' class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] # 入栈 阅读全文
posted @ 2021-09-08 21:50 道友请留步W 阅读(36) 评论(0) 推荐(0) 编辑
摘要: ''' 链表实现 ''' # 节点 class Node: def __init__(self, init_data): self.data = init_data self.next = None def get_data(self): return self.data def get_next( 阅读全文
posted @ 2021-09-07 23:11 道友请留步W 阅读(50) 评论(0) 推荐(0) 编辑
摘要: ''' 双端队列 线性结构 首尾两端皆可添加删除数据 ''' class Deque: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def addFront(self, item): s 阅读全文
posted @ 2021-09-06 23:06 道友请留步W 阅读(47) 评论(0) 推荐(0) 编辑
摘要: ''' 队列 Queue 先进先出 ''' class MyQueue: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] # 入队列 def enqueue(self, item): sel 阅读全文
posted @ 2021-09-06 19:46 道友请留步W 阅读(32) 评论(0) 推荐(0) 编辑
摘要: stack.py ''' 栈 实现语言: Python 有次序的数据集, 每个数据项仅从栈顶一端加入和移除 ''' class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] 阅读全文
posted @ 2021-09-05 22:40 道友请留步W 阅读(29) 评论(0) 推荐(0) 编辑
摘要: CMakeLists.txt cmake_minimum_required(VERSION 3.20) project(tttt) set(CMAKE_CXX_STANDARD 17) # 将C/Cpp源文件生成动态库和静态库 add_library(hello_shared SHARED hell 阅读全文
posted @ 2021-09-05 21:33 道友请留步W 阅读(141) 评论(0) 推荐(0) 编辑