Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:34:14

0001 /// @file
0002 // Copyright (c) 2009-2020 Vladimir Batov.
0003 // Use, modification and distribution are subject to the Boost Software License,
0004 // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt.
0005 
0006 #ifndef BOOST_MAKE_DEFAULT_HPP
0007 #define BOOST_MAKE_DEFAULT_HPP
0008 
0009 namespace boost
0010 {
0011     /// @details A considerable number of libraries require an instance of a class
0012     /// provided (storage created and initialized). For example,
0013     /// @code
0014     ///    Type result;
0015     ///    ...
0016     ///    istream >> result;
0017     /// @endcode
0018     /// In generic code that results in the Default Constructibility requirement imposed
0019     /// on every type 'Type' to be used with the respective code. Inevitably, that requirement
0020     /// a) either excludes all the classes that for various reasons do not meet that requirement or
0021     /// b) imposes certain (not necessarily desirable) design/implementation onto respective classes.
0022     ///
0023     /// Deployment of boost::make_default() eliminates the Default Constructibility requirement with
0024     /// @code
0025     ///    Type result = boost::make_default<Type>();
0026     ///    ...
0027     ///    istream >> result;
0028     /// @endcode
0029     /// Classes with no default constructor can now be included via a boost::make_default() specialization:
0030     /// @code
0031     /// namespace boost
0032     /// {
0033     ///     template<> inline Type make_default<Type>() { return Type(parameters); }
0034     /// }
0035     /// @endcode
0036 
0037     template<typename T> T make_default() { return T(); }
0038 }
0039 
0040 #endif // BOOST_MAKE_DEFAULT_HPP