diff options
Diffstat (limited to 'libs/variant/doc')
-rw-r--r-- | libs/variant/doc/design.xml | 23 | ||||
-rw-r--r-- | libs/variant/doc/reference/apply_visitor.xml | 115 | ||||
-rw-r--r-- | libs/variant/doc/reference/concepts.xml | 16 | ||||
-rw-r--r-- | libs/variant/doc/reference/get.xml | 172 | ||||
-rw-r--r-- | libs/variant/doc/reference/multivisitor.xml | 8 | ||||
-rw-r--r-- | libs/variant/doc/reference/polymorphic_get.xml | 174 | ||||
-rw-r--r-- | libs/variant/doc/reference/variant.xml | 205 | ||||
-rw-r--r-- | libs/variant/doc/reference/variant_fwd.xml | 3 | ||||
-rw-r--r-- | libs/variant/doc/tutorial/advanced.xml | 7 |
9 files changed, 667 insertions, 56 deletions
diff --git a/libs/variant/doc/design.xml b/libs/variant/doc/design.xml index 857d39e36..756a6bdde 100644 --- a/libs/variant/doc/design.xml +++ b/libs/variant/doc/design.xml @@ -276,29 +276,6 @@ </para> - <para><emphasis role="bold">Caveat</emphasis>: On most platforms, the - <libraryname>Type Traits</libraryname> templates - <code>has_nothrow_copy</code> and <code>has_nothrow_constructor</code> - by default return <code>false</code> for all <code>class</code> and - <code>struct</code> types. It is necessary therefore to provide - specializations of these templates as appropriate for user-defined - types, as demonstrated in the following: - -<programlisting>// ...in your code (at file scope)... - -namespace boost { - - template <> - struct <classname>has_nothrow_copy</classname>< myUDT > - : <classname>mpl::true_</classname> - { - }; - -} -</programlisting> - - </para> - <para><emphasis role="bold">Implementation Note</emphasis>: So as to make the behavior of <code>variant</code> more predictable in the aftermath of an exception, the current implementation prefers to default-construct diff --git a/libs/variant/doc/reference/apply_visitor.xml b/libs/variant/doc/reference/apply_visitor.xml index b9a8798f0..bd1f10fe7 100644 --- a/libs/variant/doc/reference/apply_visitor.xml +++ b/libs/variant/doc/reference/apply_visitor.xml @@ -21,6 +21,9 @@ <simpara>See the "visitor-only" form of <code><functionname>apply_visitor</functionname></code> for a simple way to create <code>apply_visitor_delayed_t</code> objects.</simpara> + <simpara>See <code><classname>apply_visitor_delayed_cpp14_t</classname></code> + which is used on C++14 compatible compilers when <code>Visitor</code> has no + <code>result_type</code> typedef.</simpara> </description> <template> @@ -46,6 +49,18 @@ <overloaded-method name="operator()"> <signature> <template> + <template-type-parameter name="... Variant"/> + </template> + + <type>result_type</type> + <parameter name="operand"> + <paramtype>Variant&...</paramtype> + </parameter> + </signature> + + + <signature> + <template> <template-type-parameter name="Variant"/> </template> @@ -76,10 +91,69 @@ <code><functionname>apply_visitor</functionname></code> on the stored visitor using the given operands.</simpara> </description> + <notes>Version with variadic templates is used by default if + <macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname> is not defined.</notes> + </overloaded-method> + </method-group> + </class> + + <class name="apply_visitor_delayed_cpp14_t"> + <purpose>Adapts a visitor for use as a function object.</purpose> + <description> + <simpara>Adapts the function given at construction for use as a + function object. This is useful, for example, when one needs to + operate on each element of a sequence of variant objects using a + standard library algorithm such as + <code>std::for_each</code>.</simpara> + <simpara>See the "visitor-only" form of + <code><functionname>apply_visitor</functionname></code> for a simple + way to create <code>apply_visitor_delayed_t</code> objects.</simpara> + <simpara>See <code><classname>apply_visitor_delayed_t</classname></code> + which is used when <code>Visitor</code> has <code>result_type</code> + typedef.</simpara> + <simpara>Available only if macro + <macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname> is not defined and + compiler supports <code>decltype(auto)</code> and <code>decltype(some-expression)</code>.</simpara> + </description> + + <template> + <template-type-parameter name="Visitor"/> + </template> + + <constructor specifiers="explicit"> + <parameter name="visitor"> + <paramtype>Visitor &</paramtype> + </parameter> + + <effects> + <simpara>Constructs the function object with the given + visitor.</simpara> + </effects> + </constructor> + + <method-group name="function object interface"> + <overloaded-method name="operator()"> + <signature> + <template> + <template-type-parameter name="... Variant"/> + </template> + + <type>decltype(auto)</type> + <parameter name="operand"> + <paramtype>Variant&...</paramtype> + </parameter> + </signature> + + <purpose>Function call operator.</purpose> + <description> + <simpara>Invokes + <code><functionname>apply_visitor</functionname></code> on the + stored visitor using the given operands.</simpara> + </description> </overloaded-method> </method-group> </class> - + <overloaded-function name="apply_visitor"> <signature> <template> @@ -96,7 +170,7 @@ <paramtype>Variant &</paramtype> </parameter> </signature> - + <signature> <template> <template-type-parameter name="Visitor"/> @@ -120,7 +194,7 @@ <template-type-parameter name="Variant2"/> </template> - <type>typename BinaryVisitor::result_type</type> + <type>typename BinaryVisitor::result_type OR decltype(auto)</type> <parameter name="visitor"> <paramtype>BinaryVisitor &</paramtype> @@ -140,7 +214,7 @@ <template-type-parameter name="Variant2"/> </template> - <type>typename BinaryVisitor::result_type</type> + <type>typename BinaryVisitor::result_type OR decltype(auto)</type> <parameter name="visitor"> <paramtype>const BinaryVisitor &</paramtype> @@ -161,7 +235,7 @@ <template-type-parameter name="Variant3"/> </template> - <type>typename MultiVisitor::result_type</type> + <type>typename MultiVisitor::result_type OR decltype(auto)</type> <parameter name="visitor"> <paramtype>MultiVisitor &</paramtype> @@ -188,7 +262,7 @@ <template-type-parameter name="Variant3"/> </template> - <type>typename MultiVisitor::result_type</type> + <type>typename MultiVisitor::result_type OR decltype(auto)</type> <parameter name="visitor"> <paramtype>const MultiVisitor &</paramtype> @@ -219,6 +293,19 @@ </parameter> </signature> + + <signature> + <template> + <template-type-parameter name="Visitor"/> + </template> + + <type><classname>apply_visitor_delayed_cpp14_t</classname><Visitor></type> + + <parameter name="visitor"> + <paramtype>Visitor &</paramtype> + </parameter> + </signature> + <purpose> <simpara>Allows compile-time checked type-safe application of the given visitor to the content of the given variant, ensuring that all @@ -243,13 +330,17 @@ <listitem>Overloads accepting three or more operands invoke the function call operator of the given visitor on the content of the given <code><classname>variant</classname></code> - operands. Maximum amount of parameters controlled by + operands. Maximum amount of parameters controlled by <code><emphasis role="bold"><macroname>BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS</macroname></emphasis></code> - macro. Those functions are actually defined in <xref linkend="header.boost.variant.multivisitors_hpp"/>.</listitem> - - <listitem>The overload accepting only a visitor returns a - <classname alt="boost::apply_visitor_delayed_t">generic function object</classname> - that accepts either one or two arguments and invokes + macro. Those functions are actually defined in a header <code>boost/variant/multivisitors.hpp</code> + (See <xref linkend="header.boost.variant.multivisitors_hpp"/>). That header must be manually included + if multi visitors are meant for use.</listitem> + + <listitem>The overloads accepting only a visitor return a + <classname alt="boost::apply_visitor_delayed_t">C++03 compatible generic function object</classname> + or + <classname alt="boost::apply_visitor_delayed_cpp14_t">C++14 compatible generic function object</classname> + that accepts either one, two or arbitrary count of arguments and invoke <code><functionname>apply_visitor</functionname></code> using these arguments and <code>visitor</code>, thus behaving as specified above. (This behavior is particularly useful, for diff --git a/libs/variant/doc/reference/concepts.xml b/libs/variant/doc/reference/concepts.xml index 78c418e4a..03534ec2c 100644 --- a/libs/variant/doc/reference/concepts.xml +++ b/libs/variant/doc/reference/concepts.xml @@ -82,7 +82,9 @@ <listitem>Must allow invocation as a function by overloading <code>operator()</code>, unambiguously accepting any value of type <code>T</code>.</listitem> - <listitem>Must expose inner type <code>result_type</code>. (See + <listitem>Must expose inner type <code>result_type</code>. C++14 compatible compilers + could detect <code>result_type</code> automatically, but will stick to + <code>result_type</code> if it is defined. (See <code><functionname>boost::visitor_ptr</functionname></code> for a solution to using functions as visitors.)</listitem> <listitem>If <code>result_type</code> is not <code>void</code>, then @@ -131,6 +133,18 @@ public: } };</programlisting> + <para>C++14 compatible compilers detect <code>result_type</code> automatically:</para> + +<programlisting> + <classname>boost::variant</classname><int, float> v; + // ... + + <functionname>boost::apply_visitor</functionname>( + [](auto val) { return std::to_string(val); }, + v + ); +</programlisting> + </section> </section> diff --git a/libs/variant/doc/reference/get.xml b/libs/variant/doc/reference/get.xml index d8231bf56..ed30aa8de 100644 --- a/libs/variant/doc/reference/get.xml +++ b/libs/variant/doc/reference/get.xml @@ -26,7 +26,7 @@ </method> </class> - <overloaded-function name="get"> + <overloaded-function name="relaxed_get"> <signature> <template> <template-type-parameter name="U"/> @@ -58,7 +58,7 @@ <paramtype>const <classname>variant</classname><T1, T2, ..., TN> *</paramtype> </parameter> </signature> - + <signature> <template> <template-type-parameter name="U"/> @@ -93,7 +93,9 @@ <purpose> <simpara>Retrieves a value of a specified type from a given - <code><classname>variant</classname></code>.</simpara> + <code><classname>variant</classname></code>. </simpara> + <simpara>Unlike <functionname>strict_get</functionname> does not assert at compile time + that type <code>U</code> is one of the types that can be stored in variant.</simpara> </purpose> <description> @@ -102,6 +104,11 @@ <code><classname>variant</classname></code>. The function succeeds only if the content is of the specified type <code>U</code>, with failure indicated as described below.</simpara> + <simpara><emphasis role="bold">Recomendation</emphasis>: Use + <functionname>get</functionname> or <functionname>strict_get</functionname> in new code. + <functionname>strict_get</functionname> + provides more compile time checks and it's behavior is closer to <code>std::get</code> + from C++ Standard Library.</simpara> <simpara><emphasis role="bold">Warning</emphasis>: After either <code>operand</code> or its content is destroyed (e.g., when the given <code><classname>variant</classname></code> is assigned a @@ -148,5 +155,164 @@ </rationale> </overloaded-function> + <overloaded-function name="strict_get"> + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>U *</type> + + <parameter name="operand"> + <paramtype><classname>variant</classname><T1, T2, ..., TN> *</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>const U *</type> + + <parameter name="operand"> + <paramtype>const <classname>variant</classname><T1, T2, ..., TN> *</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>U &</type> + + <parameter name="operand"> + <paramtype><classname>variant</classname><T1, T2, ..., TN> &</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>const U &</type> + + <parameter name="operand"> + <paramtype>const <classname>variant</classname><T1, T2, ..., TN> &</paramtype> + </parameter> + </signature> + + <purpose> + <simpara>Retrieves a value of a specified type from a given + <code><classname>variant</classname></code>.</simpara> + </purpose> + + <description> + <simpara>Acts exactly like <functionname>relaxed_get</functionname> but does a compile time check + that type <code>U</code> is one of the types that can be stored in variant.</simpara> + </description> + </overloaded-function> + + <overloaded-function name="get"> + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>U *</type> + + <parameter name="operand"> + <paramtype><classname>variant</classname><T1, T2, ..., TN> *</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>const U *</type> + + <parameter name="operand"> + <paramtype>const <classname>variant</classname><T1, T2, ..., TN> *</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>U &</type> + + <parameter name="operand"> + <paramtype><classname>variant</classname><T1, T2, ..., TN> &</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>const U &</type> + + <parameter name="operand"> + <paramtype>const <classname>variant</classname><T1, T2, ..., TN> &</paramtype> + </parameter> + </signature> + + <purpose> + <simpara>Retrieves a value of a specified type from a given + <code><classname>variant</classname></code>.</simpara> + </purpose> + + <description> + <simpara>Evaluates to <functionname>strict_get</functionname> if <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code> + is not defined. If <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code> + is defined then evaluates to <functionname>relaxed_get</functionname>. </simpara> + + <simpara><emphasis role="bold">Recomendation</emphasis>: Use + <functionname>get</functionname> in new code without defining + <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>. In that way <functionname>get</functionname> + provides more compile time checks and it's behavior is closer to <code>std::get</code> + from C++ Standard Library.</simpara> + </description> + </overloaded-function> + </namespace> </header> diff --git a/libs/variant/doc/reference/multivisitor.xml b/libs/variant/doc/reference/multivisitor.xml index f9708d813..aef4a3bd1 100644 --- a/libs/variant/doc/reference/multivisitor.xml +++ b/libs/variant/doc/reference/multivisitor.xml @@ -16,7 +16,9 @@ <macro name="BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS"> <purpose> <simpara>Controls maximum amount of <code><classname>variant</classname></code> - parameters for multi visistors. </simpara> + parameters for multi visistors. Not used when <code>std::tuple</code> is available and + <code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname></code> + is not defined.</simpara> </purpose> <description> @@ -44,7 +46,7 @@ <template-type-parameter name="Variant3"/> </template> - <type>typename MultiVisitor::result_type</type> + <type>typename MultiVisitor::result_type OR decltype(auto)</type> <parameter name="visitor"> <paramtype>MultiVisitor &</paramtype> @@ -71,7 +73,7 @@ <template-type-parameter name="Variant3"/> </template> - <type>typename MultiVisitor::result_type</type> + <type>typename MultiVisitor::result_type OR decltype(auto)</type> <parameter name="visitor"> <paramtype>const MultiVisitor &</paramtype> diff --git a/libs/variant/doc/reference/polymorphic_get.xml b/libs/variant/doc/reference/polymorphic_get.xml index f6d85384c..aea0a7599 100644 --- a/libs/variant/doc/reference/polymorphic_get.xml +++ b/libs/variant/doc/reference/polymorphic_get.xml @@ -26,7 +26,7 @@ </method> </class> - <overloaded-function name="polymorphic_get"> + <overloaded-function name="polymorphic_relaxed_get"> <signature> <template> <template-type-parameter name="U"/> @@ -58,7 +58,7 @@ <paramtype>const <classname>variant</classname><T1, T2, ..., TN> *</paramtype> </parameter> </signature> - + <signature> <template> <template-type-parameter name="U"/> @@ -94,6 +94,8 @@ <purpose> <simpara>Retrieves a value of a specified type from a given <code><classname>variant</classname></code>.</simpara> + <simpara>Unlike <functionname>polymorphic_strict_get</functionname> does not assert at compile time + that type <code>U</code> is one of the types that can be stored in variant.</simpara> </purpose> <description> @@ -103,6 +105,12 @@ only if the content is of the specified type <code>U</code> or of type derived from type <code>U</code>, with failure indicated as described below.</simpara> + <simpara><emphasis role="bold">Recomendation</emphasis>: Use + <functionname>polymorphic_get</functionname> or <functionname>polymorphic_strict_get</functionname> + in new code. + <functionname>polymorphic_strict_get</functionname> + provides more compile time checks and it's behavior is closer to <code>std::get</code> + from C++ Standard Library.</simpara> <simpara><emphasis role="bold">Warning</emphasis>: After either <code>operand</code> or its content is destroyed (e.g., when the given <code><classname>variant</classname></code> is assigned a @@ -152,5 +160,167 @@ </rationale> </overloaded-function> + + + <overloaded-function name="polymorphic_strict_get"> + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>U *</type> + + <parameter name="operand"> + <paramtype><classname>variant</classname><T1, T2, ..., TN> *</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>const U *</type> + + <parameter name="operand"> + <paramtype>const <classname>variant</classname><T1, T2, ..., TN> *</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>U &</type> + + <parameter name="operand"> + <paramtype><classname>variant</classname><T1, T2, ..., TN> &</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>const U &</type> + + <parameter name="operand"> + <paramtype>const <classname>variant</classname><T1, T2, ..., TN> &</paramtype> + </parameter> + </signature> + + <purpose> + <simpara>Retrieves a value of a specified type from a given + <code><classname>variant</classname></code>.</simpara> + </purpose> + + <description> + <simpara>Acts exactly like <functionname>polymorphic_relaxed_get</functionname> but does a compile time check + that type <code>U</code> is one of the types that can be stored in variant.</simpara> + </description> + </overloaded-function> + + <overloaded-function name="polymorphic_get"> + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>U *</type> + + <parameter name="operand"> + <paramtype><classname>variant</classname><T1, T2, ..., TN> *</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>const U *</type> + + <parameter name="operand"> + <paramtype>const <classname>variant</classname><T1, T2, ..., TN> *</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>U &</type> + + <parameter name="operand"> + <paramtype><classname>variant</classname><T1, T2, ..., TN> &</paramtype> + </parameter> + </signature> + + <signature> + <template> + <template-type-parameter name="U"/> + <template-type-parameter name="T1"/> + <template-type-parameter name="T2"/> + <template-varargs/> + <template-type-parameter name="TN"/> + </template> + + <type>const U &</type> + + <parameter name="operand"> + <paramtype>const <classname>variant</classname><T1, T2, ..., TN> &</paramtype> + </parameter> + </signature> + + <purpose> + <simpara>Retrieves a value of a specified type from a given + <code><classname>variant</classname></code>.</simpara> + </purpose> + + <description> + <simpara>Evaluates to <functionname>polymorphic_strict_get</functionname> + if <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code> + is not defined. If <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code> + is defined then evaluates to <functionname>polymorphic_relaxed_get</functionname>. </simpara> + + <simpara><emphasis role="bold">Recomendation</emphasis>: Use + <functionname>polymorphic_get</functionname> in new code without defining + <code>BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>. In that way + <functionname>polymorphic_get</functionname> + provides more compile time checks and it's behavior is closer to <code>std::get</code> + from C++ Standard Library.</simpara> + </description> + </overloaded-function> </namespace> </header> diff --git a/libs/variant/doc/reference/variant.xml b/libs/variant/doc/reference/variant.xml index 8c6cb8463..ba67fbeab 100644 --- a/libs/variant/doc/reference/variant.xml +++ b/libs/variant/doc/reference/variant.xml @@ -508,6 +508,12 @@ <method name="type" cv="const"> <type>const std::type_info &</type> + <notes> + <simpara><code>boost::variant</code> usues Boost.TypeIndex library so actually + <code>const boost::typeindex::type_info &</code> is returned. + This method is available even if RTTI is off.</simpara> + </notes> + <returns> <simpara><code>typeid(x)</code>, where <code>x</code> is the the content of <code>*this</code>.</simpara> @@ -515,10 +521,6 @@ <throws>Will not throw.</throws> - <notes> - <simpara>Not available when <code>BOOST_NO_TYPEID</code> is - defined.</simpara> - </notes> </method> </method-group> @@ -534,7 +536,7 @@ <paramtype>const variant &</paramtype> </parameter> </signature> - + <signature cv="const"> <type>void</type> <template> @@ -560,14 +562,60 @@ </requires> <returns> - <simpara><code>true</code> iff <code>which() == rhs.which()</code> + <simpara><code>true</code> if <code>which() == rhs.which()</code> <emphasis>and</emphasis> <code>content_this == content_rhs</code>, where <code>content_this</code> is the content of <code>*this</code> and <code>content_rhs</code> is the content of <code>rhs</code>.</simpara> </returns> - + + <throws> + <simpara>If <code>which() == rhs.which()</code> then may fail with + any exceptions arising from <code>operator==(T,T)</code>, where + <code>T</code> is the contained type of + <code>*this</code>.</simpara> + </throws> + </overloaded-method> + + <overloaded-method name="operator!=" cv="const"> + <purpose>InEquality comparison.</purpose> + + <signature cv="const"> + <type>bool</type> + <parameter name="rhs"> + <paramtype>const variant &</paramtype> + </parameter> + </signature> + + <signature cv="const"> + <type>void</type> + <template> + <template-type-parameter name="U"/> + </template> + <parameter> + <paramtype>const U &</paramtype> + </parameter> + </signature> + + <notes> + <simpara>The overload returning <code>void</code> exists only to + prohibit implicit conversion of the operator's right-hand side + to <code>variant</code>; thus, its use will (purposefully) + result in a compile-time error.</simpara> + </notes> + + <requires> + <simpara>Every bounded type of the <code>variant</code> must + fulfill the requirements of the + <conceptname>EqualityComparable</conceptname> + concept.</simpara> + </requires> + + <returns> + <simpara><code>true</code> if <code>!(*this == rhs)</code>.</simpara> + </returns> + <throws> <simpara>If <code>which() == rhs.which()</code> then may fail with any exceptions arising from <code>operator==(T,T)</code>, where @@ -585,7 +633,7 @@ <paramtype>const variant &</paramtype> </parameter> </signature> - + <signature cv="const"> <type>void</type> <template> @@ -626,6 +674,147 @@ </throws> </overloaded-method> + + <overloaded-method name="operator>"> + <purpose>GreaterThan comparison.</purpose> + + <signature cv="const"> + <type>bool</type> + <parameter name="rhs"> + <paramtype>const variant &</paramtype> + </parameter> + </signature> + + <signature cv="const"> + <type>void</type> + <template> + <template-type-parameter name="U"/> + </template> + <parameter> + <paramtype>const U &</paramtype> + </parameter> + </signature> + + <notes> + <simpara>The overload returning <code>void</code> exists only to + prohibit implicit conversion of the operator's right-hand side + to <code>variant</code>; thus, its use will (purposefully) + result in a compile-time error.</simpara> + </notes> + + <requires> + <simpara>Every bounded type of the <code>variant</code> must + fulfill the requirements of the + <conceptname>LessThanComparable</conceptname> + concept.</simpara> + </requires> + + <returns> + <simpara>true if <code>rhs < *this</code>.</simpara> + </returns> + + <throws> + <simpara>May fail with + any exceptions arising from <code>operator<(T,T)</code>, + where <code>T</code> is the contained type of + <code>*this</code>.</simpara> + </throws> + </overloaded-method> + + + <overloaded-method name="operator<="> + <purpose>LessThan or Equal comparison.</purpose> + + <signature cv="const"> + <type>bool</type> + <parameter name="rhs"> + <paramtype>const variant &</paramtype> + </parameter> + </signature> + + <signature cv="const"> + <type>void</type> + <template> + <template-type-parameter name="U"/> + </template> + <parameter> + <paramtype>const U &</paramtype> + </parameter> + </signature> + + <notes> + <simpara>The overload returning <code>void</code> exists only to + prohibit implicit conversion of the operator's right-hand side + to <code>variant</code>; thus, its use will (purposefully) + result in a compile-time error.</simpara> + </notes> + + <requires> + <simpara>Every bounded type of the <code>variant</code> must + fulfill the requirements of the + <conceptname>LessThanComparable</conceptname> + concept.</simpara> + </requires> + + <returns> + <simpara>true if <code>!(*this > rhs)</code>.</simpara> + </returns> + + <throws> + <simpara>May fail with + any exceptions arising from <code>operator<(T,T)</code>, + where <code>T</code> is the contained type of + <code>*this</code>.</simpara> + </throws> + </overloaded-method> + + + <overloaded-method name="operator>="> + <purpose>GreaterThan or Equal comparison.</purpose> + + <signature cv="const"> + <type>bool</type> + <parameter name="rhs"> + <paramtype>const variant &</paramtype> + </parameter> + </signature> + + <signature cv="const"> + <type>void</type> + <template> + <template-type-parameter name="U"/> + </template> + <parameter> + <paramtype>const U &</paramtype> + </parameter> + </signature> + + <notes> + <simpara>The overload returning <code>void</code> exists only to + prohibit implicit conversion of the operator's right-hand side + to <code>variant</code>; thus, its use will (purposefully) + result in a compile-time error.</simpara> + </notes> + + <requires> + <simpara>Every bounded type of the <code>variant</code> must + fulfill the requirements of the + <conceptname>LessThanComparable</conceptname> + concept.</simpara> + </requires> + + <returns> + <simpara>true if <code>!(*this < lhs)</code>.</simpara> + </returns> + + <throws> + <simpara>May fail with + any exceptions arising from <code>operator<(T,T)</code>, + where <code>T</code> is the contained type of + <code>*this</code>.</simpara> + </throws> + </overloaded-method> + </method-group> </class> diff --git a/libs/variant/doc/reference/variant_fwd.xml b/libs/variant/doc/reference/variant_fwd.xml index 60765ca9b..f94c75e48 100644 --- a/libs/variant/doc/reference/variant_fwd.xml +++ b/libs/variant/doc/reference/variant_fwd.xml @@ -42,7 +42,8 @@ Users may define this macro to make <code><macroname>BOOST_VARIANT_ENUM_PARAMS</macroname></code> and <code><macroname>BOOST_VARIANT_ENUM_SHIFTED_PARAMS</macroname></code> expand - to a comma-separated sequence instead of variadic templates. + to a comma-separated sequence instead of variadic templates. Define this macro if + your compiler has problems with compilation of variadic templates. </simpara> </purpose> </macro> diff --git a/libs/variant/doc/tutorial/advanced.xml b/libs/variant/doc/tutorial/advanced.xml index 6f63763f2..d4e8be738 100644 --- a/libs/variant/doc/tutorial/advanced.xml +++ b/libs/variant/doc/tutorial/advanced.xml @@ -397,19 +397,20 @@ struct if_visitor: public <classname>boost::static_visitor</classname><arithm arguments by means of <code>apply_visitor</code>: <programlisting> -bool_like_t v0(1), v1(true), v2(1.0); +bool_like_t v0(true), v1(1), v2(2.0); assert( <functionname>boost::apply_visitor</functionname>(if_visitor(), v0, v1, v2) == - arithmetics_t(true) + arithmetics_t(1) ); </programlisting> </para> <para>Finally, we must note that multi visitation does not support "delayed" form of - <code><functionname>apply_visitor</functionname></code>. + <code><functionname>apply_visitor</functionname> if + <macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname> is defined</code>. </para> </section> |