mirror of
https://github.com/boostorg/optional.git
synced 2025-07-22 16:47:15 +02:00
69 lines
2.2 KiB
Plaintext
69 lines
2.2 KiB
Plaintext
[library Boost.Optional
|
|
[quickbook 1.4]
|
|
[authors [Cacciola Carballal, Fernando Luis]]
|
|
[copyright 2003-2007 Fernando Luis Cacciola Carballal]
|
|
[copyright 2014 Andrzej Krzemieński]
|
|
[category miscellaneous]
|
|
[id optional]
|
|
[dirname optional]
|
|
[purpose
|
|
Discriminated-union wrapper for optional values
|
|
]
|
|
[source-mode c++]
|
|
[license
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
(See accompanying file LICENSE_1_0.txt or copy at
|
|
[@http://www.boost.org/LICENSE_1_0.txt])
|
|
]
|
|
]
|
|
|
|
[/ Macros will be used for links so we have a central place to change them ]
|
|
|
|
|
|
[/ Cited Boost resources ]
|
|
|
|
[def __BOOST_VARIANT__ [@../../../variant/index.html Boost.Variant]]
|
|
[def __BOOST_TRIBOOL__ [@../../../../doc/html/tribool.html boost::tribool]]
|
|
|
|
[def __OPTIONAL_POINTEE__ [@../../../utility/OptionalPointee.html OptionalPointee]]
|
|
[def __COPY_CONSTRUCTIBLE__ [@../../../utility/CopyConstructible.html Copy Constructible]]
|
|
[def __FUNCTION_EQUAL_POINTEES__ [@../../../utility/OptionalPointee.html#equal `equal_pointees()`]]
|
|
[def __FUNCTION_LESS_POINTEES__ [@../../../utility/OptionalPointee.html#less `less_pointees()`]]
|
|
|
|
[def __IN_PLACE_FACTORY_HPP__ [@../../../../boost/utility/in_place_factory.hpp in_place_factory.hpp]]
|
|
[def __TYPED_IN_PLACE_FACTORY_HPP__ [@../../../../boost/utility/typed_in_place_factory.hpp typed_in_place_factory.hpp]]
|
|
|
|
[/ Other web resources ]
|
|
|
|
[def __HASKELL__ [@http://www.haskell.org/ Haskell]]
|
|
[def __SGI_DEFAULT_CONSTRUCTIBLE__ [@http://www.sgi.com/tech/stl/DefaultConstructible.html Default Constructible]]
|
|
|
|
|
|
[/ Icons ]
|
|
|
|
[def __SPACE__ [$images/space.png]]
|
|
[def __GO_TO__ [$images/callouts/R.png]]
|
|
|
|
|
|
[section Introduction]
|
|
This library can be used to represent 'optional' (or 'nullable') objects that can be safely passed by value:
|
|
|
|
optional<int> readInt(); // this function may return either an int or a not-an-int
|
|
|
|
if (optional<int> oi = readInt()) // did I get a real int
|
|
cout << "my int is: " << *oi; // use my int
|
|
else
|
|
cout << "I have no int";
|
|
|
|
[endsect]
|
|
|
|
[include motivation.qbk]
|
|
[include development.qbk]
|
|
[include reference.qbk]
|
|
[include examples.qbk]
|
|
[include special_cases.qbk]
|
|
[include dependencies.qbk]
|
|
[include acknowledgments.qbk]
|
|
|
|
|