]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/convert/doc/no_optional_interface.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / convert / doc / no_optional_interface.qbk
CommitLineData
7c673cae
FG
1[/
2 Copyright (c) Vladimir Batov 2009-2016
3 Distributed under the Boost Software License, Version 1.0.
4 See copy at http://www.boost.org/LICENSE_1_0.txt.
5]
6
7[section Alternative Interface]
8
9[:[*['"It's not a question of happiness, it's a requirement. Consider the alternative” Doug Horton]]]
10
11As it was indicated previously [@boost:/libs/optional/index.html `boost::optional`] is the actual type returned by the `boost::convert()` main interface:
12
13 boost::optional<TypeOut> boost::convert(TypeIn const&, Converter const&);
14
15The signature is ['functionally-complete], routinely elided during compilation and is the most efficient in deploying the underlying converter. That said, the following alternative (and arguably more traditional) interface might be potentially more suitable for certain deployment scenarios (or due to personal preferences):
16
17 TypeOut convert(TypeIn const&, Converter const&, TypeOut const& fallback_value);
18 TypeOut convert(TypeIn const&, Converter const&, Functor const& fallback_functor);
19 TypeOut convert(TypeIn const&, Converter const&, boost::throw_on_failure);
20
21It still provides unambigous behavior and readability, full support for various program flows and various degrees of conversion-failure detection and processing. It can be deployed in a similar fashion as follows:
22
23[getting_serious_example5]
24[getting_serious_example7]
25
26Still, the described interfaces are convenience wrappers around the main interface which provides the described behavior with:
27
28[getting_serious_example8]
29
30or with the default converter defined:
31
32[getting_serious_default_converter]
33[getting_serious_example9]
34
35[endsect] [/section Return Value]
36
37
38
39