]> git.sesse.net Git - casparcg/blob - dependencies64/boost/boost/make_default.hpp
[general] Added cg_producer_registry as dependency in frame_producer_dependencies
[casparcg] / dependencies64 / boost / boost / make_default.hpp
1 /// @file
2 // Copyright (c) 2009-2014 Vladimir Batov.
3 // Use, modification and distribution are subject to the Boost Software License,
4 // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt.
5
6 #ifndef BOOST_MAKE_DEFAULT_HPP
7 #define BOOST_MAKE_DEFAULT_HPP
8
9 namespace boost
10 {
11     /// @details A considerable number of libraries require an instance of a class
12     /// provided (storage created and initialized). For example,
13     /// @code
14     ///    Type result;
15     ///    ...
16     ///    istream >> result;
17     /// @endcode
18     /// In generic code that results in the Default Constructibility requirement imposed
19     /// on every type 'Type' to be used with the respective code. Inevitably, that requirement
20     /// a) either excludes all the classes that for various reasons do not meet that requirement or
21     /// b) imposes certain (not necessarily desirable) design/implementation onto respective classes.
22     ///
23     /// Deployment of boost::make_default() eliminates the Default Constructibility requirement with
24     /// @code
25     ///    Type result = boost::make_default<Type>();
26     ///    ...
27     ///    istream >> result;
28     /// @endcode
29     /// Classes with no default constructor can now be included via a boost::make_default() specialization:
30     /// @code
31     /// namespace boost
32     /// {
33     ///     template<> inline Type make_default<Type>() { return Type(parameters); }
34     /// }
35     /// @endcode
36
37     template<typename T> T make_default() { return T(); }
38 }
39
40 #endif // BOOST_MAKE_DEFAULT_HPP