c++ 11 or more
seamanj
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
lambda
#include#includestd::function returnLambda(){ return [](int x, int y) { return x*y; };}int main(){ auto lf = returnLambda(); std::cout << lf(6, 7) << std::endl;}输出结果:42l原创 2016-02-06 23:35:02 · 644 阅读 · 0 评论 -
regex
The regex match and search interface//main.cpp#include #include using namespace std;void out(bool b){ cout << (b ? "found" : "not found") << endl;}int main(){ // find XML/HTML-tagged原创 2016-02-07 00:40:18 · 884 阅读 · 0 评论 -
Tuple and Tie
recently came across an interesting feature to C++11: std::tie. One of the features I love about python is that you are able to return multiple values from a function. These get returned in a struct转载 2016-02-03 00:14:44 · 660 阅读 · 0 评论 -
use count of shared_ptr
#include #include class A{};class B{public: void setA(std::shared_ptr spa) { std::cout << spa.use_count() << std::endl; spA = spa; std::cout << spa.use_count原创 2016-02-17 05:02:09 · 810 阅读 · 0 评论 -
shared_ptr and "<"
a shared_ptr implements some comparison operators- e.g., a shared_ptr implements the “- but, it doesn’t invoke “‣ instead, it just promises a stable, strict ordering‣ given two shared pointers转载 2016-03-04 22:23:44 · 474 阅读 · 0 评论 -
std::slice
std::sliceclass slice;Valarray slice selectorThis class represents a valarray slice selector. It does not contain nor refers to any element - it only describes a selection of elements to转载 2016-06-02 19:17:25 · 986 阅读 · 0 评论 -
stable_partition
quote from : http://en.cppreference.com/w/cpp/algorithm/stable_partitionstd::stable_partition C++ Algorithm library Defined in header原创 2016-06-23 17:24:49 · 761 阅读 · 0 评论 -
void* 与 shared_ptr的相互转换
https://stackoverflow.com/questions/23204255/how-to-cast-void-to-shared-ptrmytypeglfwSetWindowUserPointer(m_window, &m_viewport);由于glfw的callback只能是static, 所以通过设置UserPointer来传递成员变量 auto viewport原创 2017-12-12 06:37:53 · 10206 阅读 · 1 评论 -
cast shared_ptr to shared_ptr
#include <iostream>#include <memory>int main () { std::shared_ptr<int> foo; std::shared_ptr<const int> bar; foo = std::make_shared<int>(10); bar = std::const...原创 2018-09-10 04:10:41 · 326 阅读 · 0 评论
分享