02 2022 档案

摘要:写入像素 if(img.channels() == 3) // 3通道图像 { img.at<cv::Vec3b>(0, 0)[0] = 255; img.at<cv::Vec3b>(0, 0)[1] = 255; img.at<cv::Vec3b>(0, 0)[2] = 255; } else i 阅读全文
posted @ 2022-02-28 21:29 补码 阅读(313) 评论(0) 推荐(0) 编辑
摘要:typedef enum memory_order { memory_order_relaxed, // 不对顺序做任何保证 memory_order_consume, // 标记读操作,本线程中,依赖于该值的读写不能重排到此操作前 memory_order_acquire, // 标记读操作,本线 阅读全文
posted @ 2022-02-26 14:56 补码 阅读(159) 评论(0) 推荐(0) 编辑
摘要:// 方法一template<typename T> int arr_length(T(&arr) ) { return sizeof(arr) / sizeof(arr[0]); } // 方法二 template<typenameT, int N> int arr_length(T(&arr)[ 阅读全文
posted @ 2022-02-23 12:48 补码 阅读(305) 评论(0) 推荐(1) 编辑
摘要:#include <chrono>#include <iomanip>#include <iostream> std::chrono::system_clock::time_point t = std::chrono::system_clock::now(); std::time_t c = std 阅读全文
posted @ 2022-02-22 20:51 补码 阅读(2652) 评论(0) 推荐(1) 编辑
摘要:std::counting_semaphore 具体内容看std::counting_semaphore, std::binary_semaphore - C++中文 - API参考文档 (apiref.com)。感觉使用方法和 std::condition_variable 差不多,有时间再看看源 阅读全文
posted @ 2022-02-22 12:36 补码 阅读(1333) 评论(1) 推荐(0) 编辑
摘要:官方代码如下 #include <iostream> #include <chrono> #include <ratio> #include <thread> void f() { std::this_thread::sleep_for(std::chrono::seconds(1)); } int 阅读全文
posted @ 2022-02-16 17:05 补码 阅读(94) 评论(0) 推荐(0) 编辑
摘要:std::condition_variable 和 std::condition_variable_any 都用于线程同步,前者只能与 std::unique_lock 配合,后者是前者泛化,可以和任何 lock 配合。线程同步是指线程间需要按照预定的先后次序顺序进行的行为。 综合运用std::mu 阅读全文
posted @ 2022-02-16 13:10 补码 阅读(125) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示