mirror of
https://github.com/boostorg/functional.git
synced 2026-05-05 04:15:22 +02:00
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:
@@ -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<
|
||||
|
||||
Reference in New Issue
Block a user