facade.qbk
来自「Boost provides free peer-reviewed portab」· QBK 代码 · 共 619 行 · 第 1/2 页
QBK
619 行
template<typename Dr1, typename Dr2, typename T> struct enable_if_interoperable : enable_if_interoperable_impl< is_convertible<Dr1,Dr2>::value || is_convertible<Dr2,Dr1>::value , T > {};[h2 Requirements]The following table describes the typical valid expressions on`iterator_facade`\ 's `Derived` parameter, depending on theiterator concept(s) it will model. The operations in the firstcolumn must be made accessible to member functions of class`iterator_core_access`. In addition,`static_cast<Derived*>(iterator_facade*)` shall be well-formed.In the table below, `F` is `iterator_facade<X,V,C,R,D>`, `a` is anobject of type `X`, `b` and `c` are objects of type `const X`,`n` is an object of `F::difference_type`, `y` is a constantobject of a single pass iterator type interoperable with `X`, and `z`is a constant object of a random access traversal iterator typeinteroperable with `X`... _`core operations`:.. topic:: `iterator_facade` Core Operations[table Core Operations [ [Expression] [Return Type] [Assertion/Note] [Used to implement Iterator Concept(s)] ] [ [`c.dereference()`] [`F::reference`] [] [Readable Iterator, Writable Iterator] ] [ [`c.equal(y)`] [convertible to bool] [true iff `c` and `y` refer to the same position] [Single Pass Iterator] ] [ [`a.increment()`] [unused] [] [Incrementable Iterator] ] [ [`a.decrement()`] [unused] [] [Bidirectional Traversal Iterator] ] [ [`a.advance(n)`] [unused] [] [Random Access Traversal Iterator] ] [ [`c.distance_to(z)`] [convertible to `F::difference_type`] [equivalent to `distance(c, X(z))`.] [Random Access Traversal Iterator] ]][h2 Operations]The operations in this section are described in terms of operations onthe core interface of `Derived` which may be inaccessible(i.e. private). The implementation should access these operationsthrough member functions of class `iterator_core_access`. reference operator*() const;[*Returns:] `static_cast<Derived const*>(this)->dereference()` operator->() const; (see below__)__ `operator arrow`_[*Returns:] If `reference` is a reference type, an object of type `pointer` equal to: `&static_cast<Derived const*>(this)->dereference()`Otherwise returns an object of unspecified type such that, `(*static_cast<Derived const*>(this))->m` is equivalent to `(w = **static_cast<Derived const*>(this),w.m)` for some temporary object `w` of type `value_type`... _brackets: *unspecified* operator[](difference_type n) const;[*Returns:] an object convertible to `value_type`. For constant objects `v` of type `value_type`, and `n` of type `difference_type`, `(*this)[n] = v` is equivalent to `*(*this + n) = v`, and `static_cast<value_type const&>((*this)[n])` is equivalent to `static_cast<value_type const&>(*(*this + n))` Derived& operator++();[*Effects:] static_cast<Derived*>(this)->increment(); return *static_cast<Derived*>(this); Derived operator++(int);[*Effects:] Derived tmp(static_cast<Derived const*>(this)); ++*this; return tmp; Derived& operator--();[*Effects:] static_cast<Derived*>(this)->decrement(); return *static_cast<Derived*>(this); Derived operator--(int);[*Effects:] Derived tmp(static_cast<Derived const*>(this)); --*this; return tmp; Derived& operator+=(difference_type n);[*Effects:] static_cast<Derived*>(this)->advance(n); return *static_cast<Derived*>(this); Derived& operator-=(difference_type n);[*Effects:] static_cast<Derived*>(this)->advance(-n); return *static_cast<Derived*>(this); Derived operator-(difference_type n) const;[*Effects:] Derived tmp(static_cast<Derived const*>(this)); return tmp -= n; template <class Dr, class V, class TC, class R, class D> Derived operator+ (iterator_facade<Dr,V,TC,R,D> const&, typename Derived::difference_type n); template <class Dr, class V, class TC, class R, class D> Derived operator+ (typename Derived::difference_type n, iterator_facade<Dr,V,TC,R,D> const&);[*Effects:] Derived tmp(static_cast<Derived const*>(this)); return tmp += n; template <class Dr1, class V1, class TC1, class R1, class D1, class Dr2, class V2, class TC2, class R2, class D2> typename enable_if_interoperable<Dr1,Dr2,bool>::type operator ==(iterator_facade<Dr1,V1,TC1,R1,D1> const& lhs, iterator_facade<Dr2,V2,TC2,R2,D2> const& rhs);[*Returns:] if `is_convertible<Dr2,Dr1>::value` then `((Dr1 const&)lhs).equal((Dr2 const&)rhs)`. Otherwise, `((Dr2 const&)rhs).equal((Dr1 const&)lhs)`. template <class Dr1, class V1, class TC1, class R1, class D1, class Dr2, class V2, class TC2, class R2, class D2> typename enable_if_interoperable<Dr1,Dr2,bool>::type operator !=(iterator_facade<Dr1,V1,TC1,R1,D1> const& lhs, iterator_facade<Dr2,V2,TC2,R2,D2> const& rhs);[*Returns:] if `is_convertible<Dr2,Dr1>::value` then `!((Dr1 const&)lhs).equal((Dr2 const&)rhs)`. Otherwise, `!((Dr2 const&)rhs).equal((Dr1 const&)lhs)`. template <class Dr1, class V1, class TC1, class R1, class D1, class Dr2, class V2, class TC2, class R2, class D2> typename enable_if_interoperable<Dr1,Dr2,bool>::type operator <(iterator_facade<Dr1,V1,TC1,R1,D1> const& lhs, iterator_facade<Dr2,V2,TC2,R2,D2> const& rhs);[*Returns:] if `is_convertible<Dr2,Dr1>::value` then `((Dr1 const&)lhs).distance_to((Dr2 const&)rhs) < 0`. Otherwise, `((Dr2 const&)rhs).distance_to((Dr1 const&)lhs) > 0`. template <class Dr1, class V1, class TC1, class R1, class D1, class Dr2, class V2, class TC2, class R2, class D2> typename enable_if_interoperable<Dr1,Dr2,bool>::type operator <=(iterator_facade<Dr1,V1,TC1,R1,D1> const& lhs, iterator_facade<Dr2,V2,TC2,R2,D2> const& rhs);[*Returns:] if `is_convertible<Dr2,Dr1>::value` then `((Dr1 const&)lhs).distance_to((Dr2 const&)rhs) <= 0`. Otherwise, `((Dr2 const&)rhs).distance_to((Dr1 const&)lhs) >= 0`. template <class Dr1, class V1, class TC1, class R1, class D1, class Dr2, class V2, class TC2, class R2, class D2> typename enable_if_interoperable<Dr1,Dr2,bool>::type operator >(iterator_facade<Dr1,V1,TC1,R1,D1> const& lhs, iterator_facade<Dr2,V2,TC2,R2,D2> const& rhs);[*Returns:] if `is_convertible<Dr2,Dr1>::value` then `((Dr1 const&)lhs).distance_to((Dr2 const&)rhs) > 0`. Otherwise, `((Dr2 const&)rhs).distance_to((Dr1 const&)lhs) < 0`. template <class Dr1, class V1, class TC1, class R1, class D1, class Dr2, class V2, class TC2, class R2, class D2> typename enable_if_interoperable<Dr1,Dr2,bool>::type operator >=(iterator_facade<Dr1,V1,TC1,R1,D1> const& lhs, iterator_facade<Dr2,V2,TC2,R2,D2> const& rhs);[*Returns:] if `is_convertible<Dr2,Dr1>::value` then `((Dr1 const&)lhs).distance_to((Dr2 const&)rhs) >= 0`. Otherwise, `((Dr2 const&)rhs).distance_to((Dr1 const&)lhs) <= 0`... _minus: template <class Dr1, class V1, class TC1, class R1, class D1, class Dr2, class V2, class TC2, class R2, class D2> typename enable_if_interoperable<Dr1,Dr2,difference>::type operator -(iterator_facade<Dr1,V1,TC1,R1,D1> const& lhs, iterator_facade<Dr2,V2,TC2,R2,D2> const& rhs);[*Return Type:] if `is_convertible<Dr2,Dr1>::value` then `difference` shall be `iterator_traits<Dr1>::difference_type`. Otherwise `difference` shall be `iterator_traits<Dr2>::difference_type`[*Returns:] if `is_convertible<Dr2,Dr1>::value` then `-((Dr1 const&)lhs).distance_to((Dr2 const&)rhs)`. Otherwise, `((Dr2 const&)rhs).distance_to((Dr1 const&)lhs)`.[endsect][include facade_tutorial.qbk][endsect]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?