C++ Technical Report 1 (TR1)是ISO/IEC TR 19768, C++ Library Extensions(函式库扩充)的一般名称。TR1是一份文件,内容提出了对C++标准函式库的追加项目。这些追加项目包括了正则表达式、智能指针、哈希表、随机数生成器等。TR1自己并非标准,他是一份草稿文件。然而他所提出的项目很有可能成为下次的官方标准。这份文件的目标在于「为扩充的C++标准函式库建立更为广泛的现成实作品」。
C++ TR1 和 C++0x
原创
©著作权归作者所有:来自51CTO博客作者fkjiguang的原创作品,请联系作者获取转载授权,否则将追究法律责任
C++ tr1是针对C++标准库的第一次扩展。即将到来的下一个版本的C++标准c++0x会包括它,以及一些语言本身的扩充。tr1包括大家期待已久的smart pointer,正则表达式以及其他一些支持范型编程的东东。草案阶段,新增的类和模板的名字空间是std::tr1.
C++ Technical Report 1 (TR1) is the common name for ISO/IEC TR 19768, C++ Library Extensions, which is a document proposing additions to the C++ standard library. The additions include regular expressions, smart pointers, hash tables, and random number generators. TR1 is not a standard itself, but rather a draft document. However, most of its proposals are likely to become part of the next official standard. In the meantime, vendors can use this document as a guide to create extensions. The report's goal is “to build more widespread existing practice for an expanded C++ standard library.”
C++0x (pronounced see plus plus oh ex)[1] is the unofficial name of the planned new standard for the C++ programming language. It is intended to replace the existing C++ standard, ISO/IEC 14882, which was published in 1998 and updated in 2003. These predecessors are informally known as C++98 and C++03. The new standard will include several additions to the core language and will extend the C++ standard library, incorporating most of the C++ Technical Report 1 (TR1) libraries - most likely with the exception of the library of mathematical special functions.
using std::tr1::function
2010年10月14日 6:35
Silver_Gates
This is a simple example of using std::tr1::function. Thq question is at the end of the code
#include “stdafx.h”
#include <iostream>
#include <vector>
#include <functional>
//using std::tr1::function;
typedef std::tr1::function< long (int,int) >Callback;
typedef std::vector<Callback> Callbacks;
Callbacks callbacks;
long myfunction(int a,int b)
{
std::cout 《 “Function Called \n”;
return 12;
}
int _tmain(int argc, _TCHAR* argv[])
{
//Now callbacks is a vector lets resize it
callbacks.resize(1);
//Now store address of myfunction in callback
callbacks[0]= &myfunction;
//Now call the function using the cector and passing 5 as parameter
Callback& callback = callbacks[0];
std::cout 《 callback(12,14);
std::cin.get();
return 0;
}
However i have two questions:
1)in which scenario would we get something like
typedef std::function< void (ME*, typename traits< t >::ContentType ) > Callback;
what does Me mean and what could the function be like?/
2)in which scenario would we use it like this
callback( this, content ); //?? what is content ???
any ideas would be great !!!
A candle loses nothing by lighting another candle.
上一篇:轻松解决“正在连接”无线的故障
下一篇:我的友情链接
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
C++ STL源码剖析 tr1与std array
C++ STL源码剖析 tr1与std array 深入底层,层层剖析 by 光城0.导语源码剖析版本为gcc4.9.1。C++ tr1全称Technical ...
迭代器 数组 c++ #include stl源码剖析 -
C++智能指针:TR1的 shared_ptr 和 weak_ptr 使用介绍
(所有示例的运行,将#序号所在main()函数去掉序号即可
C++ sed ide #include -
C++0x简讯
C++0x简讯
c++ 新特性 内存模型 并发编程 类型系统 -
C++0x新特性
我是在一个帖子上摘抄的大神语录。。。感谢supermegaboy大神,给了详尽的解
构造器 c++0x c++ 初始化 编译器