summaryrefslogtreecommitdiff
path: root/libs/variant/doc/reference/concepts.xml
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2015-04-08 03:09:47 +0000
committer <>2015-05-05 14:37:32 +0000
commitf2541bb90af059680aa7036f315f052175999355 (patch)
treea5b214744b256f07e1dc2bd7273035a7808c659f /libs/variant/doc/reference/concepts.xml
parented232fdd34968697a68783b3195b1da4226915b5 (diff)
downloadboost-tarball-master.tar.gz
Imported from /home/lorry/working-area/delta_boost-tarball/boost_1_58_0.tar.bz2.HEADboost_1_58_0master
Diffstat (limited to 'libs/variant/doc/reference/concepts.xml')
-rw-r--r--libs/variant/doc/reference/concepts.xml16
1 files changed, 15 insertions, 1 deletions
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>&lt;int, float&gt; v;
+ // ...
+
+ <functionname>boost::apply_visitor</functionname>(
+ [](auto val) { return std::to_string(val); },
+ v
+ );
+</programlisting>
+
</section>
</section>