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] and routinely elided during compilation. Still, 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_func); 19 TypeOut convert(TypeIn const&, Converter const&, boost::throw_on_failure); 20 21The interface still provides unambiguous 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 30[endsect] [/section Return Value] 31 32 33 34 35