shared_ptr shared std ptr

c++中unique_ptr 的使用和理解

# unique_ptr 的使用 `std::unique_ptr`是c++11起引入的智能指针,为什么必须要在c++11起才有该特性,主要还是c++11增加了move语义,否则无法对对象的所有权进行传递。 ## unique_ptr 介绍 - unique_ptr 不共享它的指针。它无法复制到其他 ......
unique_ptr unique ptr

c++中的weak_ptr的使用与理解

# weak_ptr 的使用 $\quad$关于为什么使用 `weak_ptr`,以及他的使用场景,我们在[这篇文章](https://www.cnblogs.com/weihao-ysgs/p/shared_ptr-weak_ptr.html)中已经进行了介绍。而对于其具体的使用方法,比如说如何通 ......
weak_ptr weak ptr

双通道MIL-STD-1553B总线通讯模块

* 双通道MIL-STD-1553B总线通讯模块 * 32bi,33 MHz CPCI/PCI/总线* 每个通道为A、B双冗余总线* 单功能可设置BC/RT/BM一种工作模式* 数据传输率: 4Mbps* 支持32位时标, 时标精度0.25微秒* 软件可设詈应答超时: 0-32767µs* 大容量的 ......
总线 模块 通道 MIL-STD 通讯

std::shared_ptr 线程安全方面的思考

一直惦记着 std::shared_ptr 线程安全的问题,看了些文章后,又怕过段时间忘记了,遂记录下来 std::shared_ptr 的线程安全问题主要有以下两种: 引用计数的加减操作是否线程安全 std::shared_ptr 修改指向时是否线程安全 第一个问题的答案: 是线程安全的,因为是原 ......
线程 shared_ptr 方面 shared std

非root用户解决Rstudo安装R包时报错 libpng16.so.16: cannot open shared object file: No such file or directory

在安装好几个R包的时候都出现了这个报错,看网上的解决方法都是root用户才能干的,我只是普通用户没法办,本来想忍忍就过去了,可是今天装个Deseq2都装不起来,并报错: libpng-config: command not found read.c:3:17: fatal error: png.h: ......
file directory 时报 用户 Rstudo

unique_ptr 与 shared_ptr 的 deleter

使用`std::unique_ptr`定义(声明)一个对象的时候,需要知道这个对象的`Deleter`,`std::unique_ptr`的原型如下: ```cpp template > class unique_ptr; ``` 如果在定义/声明一个unique_ptr对象的时候,这个对象是`im ......
unique_ptr shared_ptr ptr deleter unique

slurm 不支持--share 选项-解决方法

提交脚本含有--share 的会报错,反复安装slurm尝试都失败 sbatch slurm_script sbatch: unrecognized option '--share' Try "sbatch --help" for more information 结果是:slurm 自从14.0后 ......
方法 slurm share

7.说说你了解的auto_ptr作用

# 7.说说你了解的auto_ptr作用 1.auto_ptr的出现,主要是为了解决“有异常抛出时发生内存泄漏”的问题;抛出异常,将导致指针p所指向的空间得不到释放而导致内存泄漏; 2.auto_ptr构造时取得某个对象的控制权,在析构时释放该对象。我们实际上是创建一个auto_ptr\类型的局部对 ......
auto_ptr 作用 auto ptr

c++11 std::condition_variable

# std::condition_variable * 需要配合unique_lock使用,`wait(unique_lock&)` * notify_one()调用时,只有随机一个wait()线程会得到通知 * notify_all(),所有wait()线程会被通知并得到执行 * wait()调用 ......
condition_variable condition variable std 11

std::bitset 的常用函数

菜。 `flip`:反转。 `set()`:全部置 `1`。 `set(i)`:第 $i$ 位置 `1`。 `set(i, 0)`:第 $i$ 位置 `0`。 `reset`:置 `0`。 `count`:求 `1` 的个数。 `test`:返回第 $i$ 位是 `0/1`。 `any`:是否有 ` ......
函数 常用 bitset std

c++11 std::unique_lock

# std::unique_lock * 用法类似lock_guard,离开作用域后自动unlock * 定义的时候可以不需要mutex初始化,可以为空 * 可以手动调用lock(),unlock() ```cpp // unique_lock example #include // std::co ......
unique_lock unique lock std 11

让nlohmann json支持std::wstring和嵌套结构的序列化与反序列化

nlohmann json是一个star很高的C++ json解析库。 要让nlohmann json支持某个类型T,只要给这个类型T实现一个偏特化的struct adl_serializer<T>即可。adl_serializer是这个库里面针对泛型T预定义的适配器。 而嵌套结构,本身就支持的。使 ......
序列 nlohmann wstring 结构 json

python ImportError: libGL.so.1: cannot open shared object file: No such file or directory

# 前言 python 报错`python ImportError: libGL.so.1: cannot open shared object file: No such file or directory` 这个错误通常表示你的 `Python` 程序需要使用 `OpenGL` 库,但是该库未安 ......
file ImportError directory python cannot

c++共享锁shared_mutex

# shared_mutex * shared_mutex::lock()用法同mutex::lock() * shared_mutex::lock_shared()允许多线程同时进入临界区,只用用于只读场景,不然是线程不安全的 * shared_mutex::lock_shared()与share ......
shared_mutex shared mutex

ubuntu系统conda下运行pytorch报错:ImportError: libopenblas.so.0: cannot open shared object file

如题: ubuntu系统conda下运行pytorch报错:ImportError: libopenblas.so.0: cannot open shared object file 网上找了一些资料,基本都是自己下载openblas源码进行编译,不过突然之间相当conda环境提供一定的编译好的li ......

bcftools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

001、使用conda安装bcftools, 调用报错如下: [root@PC1 ~]# conda install bcftools -c bioconda ## conda安装 [root@PC1 ~]# bcftools ## 调用测试 002、解决方法1 [root@PC1 ~]# cond ......
shared file directory libraries libcrypto

error while loading shared libraries: libxml2.so.2: cannot open shared object file 解决方法

参考: https://blog.csdn.net/qq_39779233/article/details/128215517 error while loading shared libraries: libxml2.so.2: cannot open shared object file 解决方 ......
shared libraries loading libxml2 方法

std::move和std::forward

move和forward不进行任何操作,他们只负责类型转换。 move(x)等价于 static_cast<remove_reference_t<T>&&>(x)。因为T首先被剥夺引用,因此这里不会产生引用折叠,必定返回右值。 forward(x)等价于 static_cast<T&&> (x)。因 ......
std forward move

/usr/local/arm/5.4.0/usr/bin/../libexec/gcc/arm-none-linux-gnueabi/5.4.0/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory

arm-linux-gcc a.c报错/usr/local/arm/5.4.0/usr/bin/../libexec/gcc/arm-none-linux-gnueabi/5.4.0/cc1: error while loading shared libraries: libmpc.so.3: ca ......
shared arm-none-linux-gnueabi file usr arm

Smart Ptr - intrusive

# intrusive_ref_counter ```cpp template class intrusive_ref_counter struct thread_unsafe_counter struct thread_safe_counter ``` The `intrusive_ref_cou ......
intrusive Smart Ptr

MIL-STD-1553B总线通信模块(1553B板卡)

MIL-STD-1553B总线通信模块(1553B板卡)产品具有以下特点: 1.产品覆盖多种接口CPCI/PXI/PCI/PC104/PC104+/USB等,满足用户不同平台的使用要求; 2.自主知识产权IP核,通信速率支持1M/4M ......
板卡 1553 总线 模块 MIL-STD

std::queue 中遇到释放内存错误的问题

项目上有个需求要用到 std::queue 顺序处理消息事件 简单的示例如下: struct MyEvent { MyEvent() { event_ = CreateEvent(nullptr, 0, 0, 0); } ~MyEvent() { std::cout << "MyEvent deco ......
内存 错误 问题 queue std

c++ std::thread::joinable

# std::thread::joinable * 默认构造的thread对象 not joinable * join/detach之后 not joinable * 不能反复join/detach,会崩 * 当前线程会阻塞在join()调用处 * detach()不会阻塞当前线程,但是主进程结束后 ......
joinable thread std

std::optional 内存布局

对于`std::optional`对应的内存布局为 ```c++ struct optional_mem { int _M_payload; bool _M_engaged; }; ``` 可以通过[godbolt](https://godbolt.org "godbolt")通过pahole工具查 ......
布局 optional 内存 std

ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm).

# 报错 ``` ERROR: Unexpected bus error encountered in worker. This might be caused by insufficient shared memory (shm). ``` # 问题原因 在 `PyTorch` 中使用 `Data ......

std::bind 详解

# bind bind 是C++ 的一个函数, 用来绑定其他函数,用来改造。 ## 1. 普通函数的bind 普通函数可以被绑定,传参。 ```cpp int add(int x, int y){ cout using std::bind; int main(){ auto f = bind(&ad ......
bind std

std::ofstream 写本地音频

最近线上 PK 偶然出现双方主播互相听不见声音的情况,在日志不能明确体现问题时,就需要抓下主播本地的音频和远端的音频来确定数据是在哪消失的 所以我们用到一个比较简单的流写出的标准库类:std::ofstream 通过 std::ofstream 类,可以创建一个用于写入文件的输出流对象,可以将数据写 ......
ofstream 音频 std

bcftools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object

001、问题 [root@PC1 home]# bcftools bcftools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or d ......
shared libraries libcrypto bcftools loading

OpenSSH升级后 libcrypto.so.1.1: cannot open shared object file

之前分享过一篇[记一次手动将OpenSSH从7.4升级到9.3的过程](https://www.cnblogs.com/jianzhan/p/ssh-update.html) 这次又升级时,政务云提供了更加便捷的升级方案 给了一个升级文件:`Openssl_UPDATE_to_9.2p1.bin`和 ......
libcrypto OpenSSH cannot object shared

SQL Server(解决问题)已成功与服务器建立连接,但是在登录过程中发生错误。(provider: Shared Memory Provider, error:0 - 管道的另一端上无任何进程

如果你在使用新创建的 SQL Server 用户名和密码 对数据库进行连接的时候出现了下面的问题。阅读本篇博客可以帮助你解决这个问题。 已成功与服务器建立连接,但是在登录过程中发生错误。(provider: Shared Memory Provider, error:0 - 管道的另一端上无任何进程 ......
一端 管道 Provider provider 进程