C++疑问
文章平均质量分 73
kingeasternsun
向linus致敬!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
返回指向局部变量指针的函数 与 返回局部变量引用的函数
#include "stdafx.h" #include #include #include int& rref() { int i = 11; return i; } int* rpot() { int j = 33; return &j; } int _tmain(int argc, _TCHAR* argv[]) { int &a = rref(); int *b =原创 2012-06-13 15:37:00 · 1179 阅读 · 0 评论 -
在WINDOWS下 三步快速配置 eclipse c++ 环境
windows下面eclipse配置C++,只需三步原创 2013-06-24 13:57:32 · 1850 阅读 · 0 评论 -
string find查找函数
C++ Primer Fifth Edition 英文彩色带书签 http://download.youkuaiyun.com/detail/kingeasternsun/5529053 C++ Primer Plus (6th Edition) 英文原版 彩色带书签http://download.youkuaiyun.com/detail/kingeasternsun/5508691 string 类型提供的原创 2013-06-08 13:21:42 · 1220 阅读 · 0 评论 -
C++ 输入输出流迭代器 笔记
ostream_iterator 对象必须与特定的流绑定在一起。 ostream_iterator 不提供超出末端迭代器。 在创建ostream_iterator 对象时,可提供第二个(可选的)实参,指定将元素写入输出流时使用的分隔符。分隔符必须是 C 风格字符串。因为它是 C 风格字符串,所以必须以空字符结束;否则,其行为将是未定义的。 在创建 istream_iterator原创 2013-05-17 13:44:40 · 2123 阅读 · 0 评论 -
对minRect得到的有向方框填充
for ( vector::iterator itr = minRect.begin(); itr!=minRect.end(); itr++) { Scalar color = Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) ); Point2f rpoints[4]; (*it原创 2013-04-07 17:22:27 · 1426 阅读 · 0 评论 -
C++的输出精度控制
转自 :http://blog.sina.com.cn/s/blog_a3e4d88d010156uo.html 注意的是 ios::left 前面加std std::ios::left 使用这些格式需要声明包含 long flags( ) const 返回当前的格式标志。 long flays(long newflag) 设置格式标志为newflag,返回旧的格式标志。转载 2013-04-07 17:16:45 · 1889 阅读 · 0 评论 -
Opencv SIFT需要注意的地方
1。提取的sift 描述符是float,所以要访问每一个数据的话 for (int r = 0;r<descriptors.rows;r++){ const float *dpt = descriptors.ptr(r); for(int c = 0;c<descriptors.cols;c++){ ftrain<<(dpt[c]); if(c原创 2013-04-02 12:29:35 · 2523 阅读 · 2 评论 -
函数模版中的引用
一:函数模版和特化模版的引用 1.首先考虑特化函数模版的参数 #include "stdafx.h" #include #include #include template int compare( T ls, T rs) { if(ls<rs) return -1; if(rs<ls) return 1; return 0; } template<> int c原创 2012-06-16 12:19:36 · 943 阅读 · 0 评论 -
函数模板特化 遇到 函数重载
#include"stdafx.h" #include #include #include template class Foo { public: static long count(){return ctr;} private: static long ctr; }; template long Foo::ctr = 11; template int compare(const原创 2012-06-06 18:13:02 · 1119 阅读 · 0 评论 -
诡异的函数模版实例化
templateint compare( const T a, const T b) { std::cout<<a<<" compare "<<b<<" result is "; if(a<b) return -1; if(b<a) return 1; return 0; } 如上简单的函数模版却遇到了相当多无法理解的问题。运行如下代码 int x(2); std:原创 2012-06-10 20:20:23 · 932 阅读 · 0 评论 -
memmove、memcpy和memccpy 对比
Name: memmove Prototype: void * memmove (void *to, const void *from, size_t size) Description: memmove copies the size bytes at from into the size bytes at to, even if those two blocks of space ove原创 2014-05-19 19:54:58 · 1270 阅读 · 0 评论
分享