shared_ptr shared std ptr

tracecompass mac 安装JVM shared library does not contain the JNI_CreateJavaVM symbol问题解决

最近在学习tracecompass,因为mac 系统版本有点高,直接运行发现起不来 可能的原因 jvm 版本问题 可以通过修改Info.plist 文件添加jvm 信息 依赖库签名问题 我的jvm 是正确的,但是还是提示上边的问题,结果通过直接命令行启动,发现提示签名问题 如下 ver/libjvm ......

【c&c++】C++ 关于编译出现“undefined reference to `std::cout‘“的问题

1、问题概述 在使用gcc编译c++代码时会出现undefined reference to `std::cout',如编译如下代码: #include<iostream> using namespace std; int main() { cout<<"Hello world!"; return ......
undefined reference 问题 cout amp

【c&c++】std::string::npos的使用

std::string::nposstd::string::npos是一个常数,它等于size_type类型可以表示的最大值,用来表示一个不存在的位置,类型一般是std::container_type::size_type。 定义static const size_type npos = -1; # ......
string npos amp std

std::initialize_list<T>作为返回值

正常情况,我们应该返回一个 vector<T>,但是呢,因为我这是嵌入式,我不想动态开辟。于是我突发其想,返回个intialize_list,在写这个代码时,我就觉得可能不正确,因为intialize_list类中没有个数。抱着试一试的心态,我还是写了这个代码。结果,果然是不正确的。 原因是这样的, ......
initialize_list initialize list std gt

C++11之std::future对象的基本用法

1、 // future example #include <iostream> // std::cout #include <future> // std::async, std::future #include <chrono> // std::chrono::milliseconds // a ......
对象 future std 11

std::string对象被释放后仍然访问std::string::c_str()返回的指针(访问已经释放掉的内存)的一些总结

一个值得注意的事情 今天在调试程序,发现一个严重又很难排查的问题! 有关如何正确使用函数的”返回值“。 先看一下简单代码: #include <iostream> using namespace std; const char *test1() { std::string str = "hello" ......
string 指针 std 对象 内存

std::any

#include <iostream> #include <any> int main() { std::any a = 10; std::cout << a.type().name() << std::endl; std::cout << std::any_cast<int>(a) << std: ......
std any

如何将 std::queue 封装成线程安全的队列

仅使用互斥保护每个成员函数 问题 1 尽管运用互斥保护共享数据,条件竞争仍然无法避免,考虑如下代码: if (!q.empty()) { const int value = q.front(); q.pop(); do_something(value); } 在 empty() 和 front() ......
队列 线程 queue std

org.pentaho.di.core.exception.KettleXMLException: Unexpected problem reading shared objects from XM

【kettle】【报错】 Unexpected problem reading shared objects from XML file 当读共享文件时发生错误 Unexpected problem reading shared objects from XML file : null 当读共享文件 ......

C++ std::thread join()的理解

转自:https://www.cnblogs.com/adorkable/p/12722209.html 在学习C++11的std::thread时,起初非常不理解join()函数的作用以及使用场景,官方的解释又比较晦涩难懂,总觉得get不到关键点。看了很多文章后加上自己的理解,才觉得有了一点眉目, ......
thread join std

cpp test for and while loop time cost respectively while std::chrono::high_resolution_clock

#include <chrono> #include <condition_variable> #include <ctime> #include <fstream> #include <future> #include <iomanip> #include <iostream> #include ......

cpp std::this_thread::sleep_for(std::chrono::seconds(sleep_seconds)) for thread execution duration

#include <chrono> #include <condition_variable> #include <ctime> #include <fstream> #include <future> #include <iomanip> #include <iostream> #include ......

time_t now=time(NULL); std::cout<<ctime(&another_time);tm* ltm = localtime(&now);

#include <iostream> #include <iomanip> #include <ctime> #include<windows.h> int main() { time_t now = time(NULL); tm* ltm = localtime(&now); std::cout ......
time another_time now amp localtime

慎用std::move

编译arm版本成功, 空跑正常, 跑业务崩溃在了如下函数: deliverPacket_internal_(std::move(video_packet), false, video_packet->big) x86机器运行正常. 怀疑点: 1、依赖库问题? 所有的lib都copy到了运行环境, 大 ......
move std

std::cout 的各种输出格式

在C++中,setf()是流操作符中的一个函数,用于设置格式化标志。它有多种参数,每个参数都代表着一种特定的标志。下面是一些常见的参数及其含义: ios::scientific: 使用科学计数法表示浮点数。 ios::fixed: 使用固定点表示法表示浮点数。 ios::left: 左对齐输出。 i ......
格式 cout std

.NET: 谈谈共享项目 (Shared Project) 的使用

从 Visual Studio 2015 起,共享项目 (Shared Project) 作为新的一种项目类型被添加到项目模板列表中,它的主要目的是使多个不同类型的项目之间可以共享代码或资源。相比它的前任 PCL(Portable Class Library),它要灵活得多。因为 Shared Pr ......
Project 项目 Shared NET

关于std::vector<bool>

一、引子 std::vector<bool> 经常应用在leetcode刷题中。 但是effective stl 不建议使用std::vector<bool>,原因是: 严格意义上讲,vector<bool> 并不是一个 STL 容器; vector<bool> 底层存储的并不是 bool 类型值。 ......
vector bool std

Android存储用户登录信息最好的方式之一-Shared Preferences

对于Android应用程序,存储用户登录信息的最佳方式是使用Shared Preferences。Shared Preferences是Android提供的一个轻量级存储机制,可以存储简单的键值对数据。它非常适合存储用户设置、用户偏好和其他应用程序数据,包括登录信息。 Shared Preferen ......
Preferences Android 方式 最好 用户

解决ORA-04031:unable to allocate 56bytes of shared memory

登录PL/SQL Developer出现ORA-04031错误。 解决方式: 用oracle账号登录linux服务器 进入sqlplus sqlplus / as sysdba 查看sga大小 show parameter sga; 扩大sga空间 alter system set sga_max_ ......
allocate unable memory shared 04031

【segmentation fault】std::string析构崩溃

今天写了一个小工具,运行时发生segmentation fault,现象如下 第一步:review崩溃附近代码,产生疑惑,崩溃的地方居然是变量定义的地方 std::string accessToken; 崩溃在这个地方,我直接懵了,只是变量定义为啥会报错,没有任何思路,打算单步调试。 第二步:单步调 ......
segmentation string fault std

cpp shared_future

#include <chrono> #include <ctime> #include <future> #include <iomainp> #include <iostream> #include <sstream> #include <uuid/uuid.h> std::string get_ ......
shared_future shared future cpp

c++ std::string_view

std::string_view系C++17标准发布后新增的内容。 C++17中我们可以使用std::string_view来获取一个字符串的视图,字符串视图并不真正的创建或者拷贝字符串,而只是拥有一个字符串的查看功能。std::string_view比std::string的性能要高很多,因为每个 ......
string_view string view std

c++ std::variant

std::variant 是c++17 引入的一个类型,其作用类似于C语言中的Union,但是比Union 的功能强大的多。C语言中一个联合体Union 可以储存多种类型数据,但缺点有很多。比如:1 没有可用的方法来判断Union中真实储存的类型,获取值时也是内存拷贝的结果,可能会存在问题。这就只能 ......
variant std

shared_ptr 自定义 deleter 删除器

class Bar { public: Bar(int ii) : i(ii) { cout << "Bar(" << i << ")" << endl; } ~Bar() { cout << "~Bar(" << i << ")" << endl; } int i; }; void deleter ......
shared_ptr deleter shared ptr

std::minmax_element的简单用法

获取一个数组中的最大值和最小值,通过匿名函数声明自定义比较策略。 #include <iostream> #include <vector> #include <algorithm> #include <string> #define BUFSIZE 6 using namespace std; t ......
minmax_element element minmax std

c++ std::package_task,task.get_future()

#include <iostream> #include <future> #include <thread> int countdown(int from,int to) { for(int i=from;i!=to;--i) { std::cout<<i<<std::endl; std::thi ......
task package_task get_future package future

C++17:新特性之std::optional

考虑一个问题,C++如何实现返回多个值?如何标记其中一个bool返回值用于记录函数运行状态? 我们可以通过pair或tuple实现,有以下代码: #include <iostream> #include <string> using namespace std; struct ss { string ......
optional 特性 std 17

C++11新特性之std::function和bind绑定器

在C++中,存在可调用对象这一个概念,可调用对象有以下几种定义: (1).是一个函数指针 (2).是一个具有operator()成员函数的类对象(仿函数) (3).是一个可被转换为函数指针的类对象 (4).是一个类成员(函数指针) 一、可调用对象包装器 std::function std::func ......
function 特性 bind std 11

cpp get exact time and precision reach nanoseconds via std::chrono::high_resolution_clock

#include <chrono> #include <ctime> #include <iomapip> #include <iostream> #include <sstream> std::string get_time_now() { std::chrono::time_point<std: ......

std::forward完美转发

std::forward被称为完美转发,它的作用是保持原来的值属性不变。 啥意思呢?通俗的讲就是,如果原来的值是左值,经std::forward处理后该值还是左值;如果原来的值是右值,经std::forward处理后它还是右值。 简单样例如下: #include <iostream> templat ......
forward std