Change default factory allocator to 'void'.

To remove the dependency on Boost.Optional. Supplied a macro for
backwards compatibility, but that will be removed in a future release.
This commit is contained in:
Daniel James
2015-01-10 13:03:07 +00:00
parent 980e1e4078
commit 188c8d4c5d
4 changed files with 72 additions and 3 deletions
+18 -2
View File
@@ -15,11 +15,14 @@
# include <new>
# include <boost/pointee.hpp>
# include <boost/none_t.hpp>
# include <boost/get_pointer.hpp>
# include <boost/non_type.hpp>
# include <boost/type_traits/remove_cv.hpp>
# if defined(BOOST_FUNCTIONAL_FACTORY_SUPPORT_NONE_T)
# include <boost/none_t.hpp>
# endif
# ifndef BOOST_FUNCTIONAL_FACTORY_MAX_ARITY
# define BOOST_FUNCTIONAL_FACTORY_MAX_ARITY 10
# elif BOOST_FUNCTIONAL_FACTORY_MAX_ARITY < 3
@@ -35,14 +38,20 @@ namespace boost
factory_passes_alloc_to_smart_pointer
};
#if defined(BOOST_FUNCTIONAL_FACTORY_SUPPORT_NONE_T)
template< typename Pointer, class Allocator = boost::none_t,
factory_alloc_propagation AP = factory_alloc_for_pointee_and_deleter >
class factory;
#else
template< typename Pointer, class Allocator = void,
factory_alloc_propagation AP = factory_alloc_for_pointee_and_deleter >
class factory;
#endif
//----- ---- --- -- - - - -
template< typename Pointer, factory_alloc_propagation AP >
class factory<Pointer, boost::none_t, AP>
class factory<Pointer, void, AP>
{
public:
typedef typename boost::remove_cv<Pointer>::type result_type;
@@ -56,6 +65,13 @@ namespace boost
# include BOOST_PP_ITERATE()
};
#if defined(BOOST_FUNCTIONAL_FACTORY_SUPPORT_NONE_T)
template< typename Pointer, factory_alloc_propagation AP >
class factory<Pointer, boost::none_t, AP>
: public factory<Pointer, void, AP>
{};
#endif
template< class Pointer, class Allocator, factory_alloc_propagation AP >
class factory
: private Allocator::template rebind< typename boost::pointee<