流水账7.19

1.

 

std:tr1::function

 

-----------------what's "std:tr1::function"?--------------------

Use the std::tr1::function Class to Generalize Callbacks

 

or a C++ programmer, the term "a callback function" means at least three different things: a pointer to a freestanding function (i.e., a C function), a pointer to a member function, or a function object. However, in high level programming, these technical minutiae just get in the way. What you need is a generalized abstraction mechanism that can encapsulate any callable entity regardless of its underlying implementation. The recently standardized std::tr1::function class template offers exactly that. It's a generic callback mechanism with intuitive and uniform syntax and semantics. This article will show you how to use this class template.

 

简译:

对于C++编程人员来说,“回调函数”这个术语通常意味着三种不同的事物:

一个指向独立函数的指针(例如,一个C函数),一个指向成员函数的指针,或者,一个函数对象

然而,在高水平编程中,这些细节只会成为阻碍。你需要的是一个一般化的抽象机制,这种机制可以封装任何可调用的实体,而不管其内部的实现机制。最近标准化的std::tr1::function模板类就是这样的,它是一个有着直观和统一的语法和语义的通用回调机制。

 


How do you generalize the concept of callbacks while maintaining similar syntax and semantics to function pointers?

 


Use std::tr1::function class template as a generic wrapper for all callable entities.

 

其余部分见

http://www.devx.com/cplus/10MinuteSolution/32455/0/page/1

 

2.

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值