STL vector中的reference(2)

原文地址:http://www.cplusplus.com/reference/vector/vector-bool/reference/
public member class

std::vector::reference

class reference;
Reference type

This embedded class is the type returned by members of non-const vector when directly accessing its elements. It accesses individual bits with an interface that emulates a reference to a bool.

这个内部类是vector直接访问其元素时返回non-const引用时设计的,它使用模拟成引用的接口访问单个的bits。


Its prototype is:

  • C++98
  • C++11
1
2
3
4
5
6
7
8
9
10
class vector::reference {
  friend class vector;
  reference() noexcept;                                 // no public constructor
public:
  ~reference();
  operator bool () const noexcept;                      // convert to bool
  reference& operator= (const bool x) noexcept;         // assign from bool
  reference& operator= (const reference& x) noexcept;   // assign from bit
  void flip();                                          // flip bit value.
};


//翻译的不好的地方请多多指导,可以在下面留言或者点击左上方邮件地址给我发邮件,指出我的错误以及不足,以便我修改,更好的分享给大家,谢谢。

转载请注明出处:http://blog.csdn.net/qq844352155

2014-8-20

于GDUT





你可能感兴趣的:(STL,containers,STL,容器接口系列译文,STL,STL,vector,内存分配)