STLvectorbool中的reference(2)


STLvectorbool中的reference(2)

public member class
<vector>

std::vector<bool>::reference

class reference;
Reference type

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

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


Its prototype is:

1
2
3
4
5
6
7
8
9
10
class vector<bool>::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




发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注