#define BOOST_ALGORITHM_EQUAL_HPP
#include <algorithm> // for std::equal
-#include <functional> // for std::binary_function
#include <iterator>
namespace boost { namespace algorithm {
namespace detail {
template <class T1, class T2>
- struct eq : public std::binary_function<T1, T2, bool> {
+ struct eq {
bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;}
};
// a tolower functor
template<typename CharT>
- struct to_lowerF : public std::unary_function<CharT, CharT>
+ struct to_lowerF
{
+ typedef CharT argument_type;
+ typedef CharT result_type;
// Constructor
to_lowerF( const std::locale& Loc ) : m_Loc( &Loc ) {}
// a toupper functor
template<typename CharT>
- struct to_upperF : public std::unary_function<CharT, CharT>
+ struct to_upperF
{
+ typedef CharT argument_type;
+ typedef CharT result_type;
// Constructor
to_upperF( const std::locale& Loc ) : m_Loc( &Loc ) {}
template<
typename SeqT,
typename IteratorT=BOOST_STRING_TYPENAME SeqT::const_iterator >
- struct copy_iterator_rangeF :
- public std::unary_function< iterator_range<IteratorT>, SeqT >
+ struct copy_iterator_rangeF
{
+ typedef iterator_range<IteratorT> argument_type;
+ typedef SeqT result_type;
SeqT operator()( const iterator_range<IteratorT>& Range ) const
{
return copy_range<SeqT>(Range);
// If _HAS_AUTO_PTR_ETC is defined to 0, std::auto_ptr is not available.
// See https://www.visualstudio.com/en-us/news/vs2015-vs.aspx#C++
// and http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
-# if defined(_HAS_AUTO_PTR_ETC) && (_HAS_AUTO_PTR_ETC == 0)
+# if defined(_HAS_AUTO_PTR_ETC) && (_HAS_AUTO_PTR_ETC == 0) && !defined BOOST_NO_AUTO_PTR
# define BOOST_NO_AUTO_PTR
# endif
#endif
BOOST_FUNCTION_TEMPLATE_PARMS
>
class BOOST_FUNCTION_FUNCTION : public function_base
-
-#if BOOST_FUNCTION_NUM_ARGS == 1
-
- , public std::unary_function<T0,R>
-
-#elif BOOST_FUNCTION_NUM_ARGS == 2
-
- , public std::binary_function<T0,T1,R>
-
-#endif
-
{
public:
#ifndef BOOST_NO_VOID_RETURNS
namespace boost
{
+ namespace functional
+ {
+ namespace detail {
+#if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC
+ // std::unary_function and std::binary_function were both removed
+ // in C++17.
+
+ template <typename Arg1, typename Result>
+ struct unary_function
+ {
+ typedef Arg1 argument_type;
+ typedef Result result_type;
+ };
+
+ template <typename Arg1, typename Arg2, typename Result>
+ struct binary_function
+ {
+ typedef Arg1 first_argument_type;
+ typedef Arg2 second_argument_type;
+ typedef Result result_type;
+ };
+#else
+ // Use the standard objects when we have them.
+
+ using std::unary_function;
+ using std::binary_function;
+#endif
+ }
+ }
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// --------------------------------------------------------------------------
// The following traits classes allow us to avoid the need for ptr_fun
// --------------------------------------------------------------------------
template <class Predicate>
class unary_negate
- : public std::unary_function<typename unary_traits<Predicate>::argument_type,bool>
+ : public boost::functional::detail::unary_function<typename unary_traits<Predicate>::argument_type,bool>
{
public:
explicit unary_negate(typename unary_traits<Predicate>::param_type x)
// --------------------------------------------------------------------------
template <class Predicate>
class binary_negate
- : public std::binary_function<typename binary_traits<Predicate>::first_argument_type,
+ : public boost::functional::detail::binary_function<typename binary_traits<Predicate>::first_argument_type,
typename binary_traits<Predicate>::second_argument_type,
bool>
{
// --------------------------------------------------------------------------
template <class Operation>
class binder1st
- : public std::unary_function<typename binary_traits<Operation>::second_argument_type,
+ : public boost::functional::detail::unary_function<typename binary_traits<Operation>::second_argument_type,
typename binary_traits<Operation>::result_type>
{
public:
// --------------------------------------------------------------------------
template <class Operation>
class binder2nd
- : public std::unary_function<typename binary_traits<Operation>::first_argument_type,
+ : public boost::functional::detail::unary_function<typename binary_traits<Operation>::first_argument_type,
typename binary_traits<Operation>::result_type>
{
public:
// mem_fun, etc
// --------------------------------------------------------------------------
template <class S, class T>
- class mem_fun_t : public std::unary_function<T*, S>
+ class mem_fun_t : public boost::functional::detail::unary_function<T*, S>
{
public:
explicit mem_fun_t(S (T::*p)())
};
template <class S, class T, class A>
- class mem_fun1_t : public std::binary_function<T*, A, S>
+ class mem_fun1_t : public boost::functional::detail::binary_function<T*, A, S>
{
public:
explicit mem_fun1_t(S (T::*p)(A))
};
template <class S, class T>
- class const_mem_fun_t : public std::unary_function<const T*, S>
+ class const_mem_fun_t : public boost::functional::detail::unary_function<const T*, S>
{
public:
explicit const_mem_fun_t(S (T::*p)() const)
};
template <class S, class T, class A>
- class const_mem_fun1_t : public std::binary_function<const T*, A, S>
+ class const_mem_fun1_t : public boost::functional::detail::binary_function<const T*, A, S>
{
public:
explicit const_mem_fun1_t(S (T::*p)(A) const)
// mem_fun_ref, etc
// --------------------------------------------------------------------------
template <class S, class T>
- class mem_fun_ref_t : public std::unary_function<T&, S>
+ class mem_fun_ref_t : public boost::functional::detail::unary_function<T&, S>
{
public:
explicit mem_fun_ref_t(S (T::*p)())
};
template <class S, class T, class A>
- class mem_fun1_ref_t : public std::binary_function<T&, A, S>
+ class mem_fun1_ref_t : public boost::functional::detail::binary_function<T&, A, S>
{
public:
explicit mem_fun1_ref_t(S (T::*p)(A))
};
template <class S, class T>
- class const_mem_fun_ref_t : public std::unary_function<const T&, S>
+ class const_mem_fun_ref_t : public boost::functional::detail::unary_function<const T&, S>
{
public:
explicit const_mem_fun_ref_t(S (T::*p)() const)
};
template <class S, class T, class A>
- class const_mem_fun1_ref_t : public std::binary_function<const T&, A, S>
+ class const_mem_fun1_ref_t : public boost::functional::detail::binary_function<const T&, A, S>
{
public:
explicit const_mem_fun1_ref_t(S (T::*p)(A) const)
// ptr_fun
// --------------------------------------------------------------------------
template <class Arg, class Result>
- class pointer_to_unary_function : public std::unary_function<Arg,Result>
+ class pointer_to_unary_function : public boost::functional::detail::unary_function<Arg,Result>
{
public:
explicit pointer_to_unary_function(Result (*f)(Arg))
}
template <class Arg1, class Arg2, class Result>
- class pointer_to_binary_function : public std::binary_function<Arg1,Arg2,Result>
+ class pointer_to_binary_function : public boost::functional::detail::binary_function<Arg1,Arg2,Result>
{
public:
explicit pointer_to_binary_function(Result (*f)(Arg1, Arg2))
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <class T> struct hash
- : std::unary_function<T, std::size_t>
{
+ typedef T argument_type;
+ typedef std::size_t result_type;
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
std::size_t operator()(T const& val) const
{
#if BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T, unsigned int n> struct hash<T[n]>
- : std::unary_function<T[n], std::size_t>
{
+ typedef T[n] argument_type;
+ typedef std::size_t result_type;
std::size_t operator()(const T* val) const
{
return boost::hash_range(val, val+n);
{
template <class T>
struct inner
- : std::unary_function<T, std::size_t>
{
+ typedef T argument_type;
+ typedef std::size_t result_type;
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
std::size_t operator()(T const& val) const
{
#define BOOST_HASH_SPECIALIZE(type) \
template <> struct hash<type> \
- : public std::unary_function<type, std::size_t> \
{ \
+ typedef type argument_type; \
+ typedef std::size_t result_type; \
std::size_t operator()(type v) const \
{ \
return boost::hash_value(v); \
#define BOOST_HASH_SPECIALIZE_REF(type) \
template <> struct hash<type> \
- : public std::unary_function<type, std::size_t> \
{ \
+ typedef type argument_type; \
+ typedef std::size_t result_type; \
std::size_t operator()(type const& v) const \
{ \
return boost::hash_value(v); \
template <class T>
struct hash<T*>
- : public std::unary_function<T*, std::size_t>
{
+ typedef T* argument_type;
+ typedef std::size_t result_type;
std::size_t operator()(T* v) const
{
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
{
template <class T>
struct inner
- : public std::unary_function<T, std::size_t>
{
+ typedef T argument_type;
+ typedef std::size_t result_type;
std::size_t operator()(T val) const
{
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590)
template <class Graph, class CostType>
- class astar_heuristic : public std::unary_function<
- typename graph_traits<Graph>::vertex_descriptor, CostType>
+ class astar_heuristic
{
public:
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+ typedef Vertex argument_type;
+ typedef CostType result_type;
astar_heuristic() {}
CostType operator()(Vertex u) { return static_cast<CostType>(0); }
};
// Similar to std::plus<T>, but maximizes parameters
// rather than adding them.
template <typename T>
- struct maximize : public std::binary_function<T, T, T>
+ struct maximize
{
+ typedef T result_type;
+ typedef T first_argument_type;
+ typedef T second_argument_type;
T operator ()(T x, T y) const
{ BOOST_USING_STD_MAX(); return max BOOST_PREVENT_MACRO_SUBSTITUTION (x, y); }
};
// types, but should be specialized for those types that have
// discrete notions of reciprocals.
template <typename T>
- struct reciprocal : public std::unary_function<T, T>
+ struct reciprocal
{
- typedef std::unary_function<T, T> function_type;
- typedef typename function_type::result_type result_type;
- typedef typename function_type::argument_type argument_type;
+ typedef T result_type;
+ typedef T first_argument_type;
T operator ()(T t)
{ return T(1) / t; }
};
template<typename Vertex, typename DistanceMap, typename MinInWeightMap,
typename Combine, typename Compare>
struct min_in_distance_compare
- : std::binary_function<Vertex, Vertex, bool>
{
+ typedef Vertex first_argument_type;
+ typedef Vertex second_argument_type;
+ typedef bool result_type;
min_in_distance_compare(DistanceMap d, MinInWeightMap m,
Combine combine, Compare compare)
: distance_map(d), min_in_weight(m), combine(combine),
template<typename Vertex, typename DistanceMap, typename MinOutWeightMap,
typename Combine, typename Compare>
- struct min_out_distance_compare
- : std::binary_function<Vertex, Vertex, bool>
+ struct min_out_distance_compares
{
+ typedef Vertex first_argument_type;
+ typedef Vertex second_argument_type;
+ typedef bool result_type;
min_out_distance_compare(DistanceMap d, MinOutWeightMap m,
Combine combine, Compare compare)
: distance_map(d), min_out_weight(m), combine(combine),
};
template<typename T>
- struct minimum : std::binary_function<T, T, T>
+ struct minimum
{
+ typedef T first_argument_type;
+ typedef T second_argument_type;
+ typedef T result_type;
const T& operator()(const T& x, const T& y) const { return x < y? x : y; }
};
template<typename T>
- struct maximum : std::binary_function<T, T, T>
+ struct maximum
{
+ typedef T first_argument_type;
+ typedef T second_argument_type;
+ typedef T result_type;
const T& operator()(const T& x, const T& y) const { return x < y? y : x; }
};
template<typename T>
- struct sum : std::binary_function<T, T, T>
+ struct sum
{
+ typedef T first_argument_type;
+ typedef T second_argument_type;
+ typedef T result_type;
const T operator()(const T& x, const T& y) const { return x + y; }
};
{
template < typename TheContainer, typename ST = std::size_t,
typename VT = typename TheContainer::value_type >
- struct subscript_t:public std::unary_function < ST, VT >
+ struct subscript_t
{
+ typedef ST& argument_type;
typedef VT& result_type;
subscript_t(TheContainer & c):container(&c)
#include <boost/assert.hpp>
#include <exception>
-#include <functional> // unary_function.
#include <iterator> // advance.
#include <list>
#include <memory> // allocator, auto_ptr.
static void set_auto_close(streambuf_type* b, bool close)
{ b->set_auto_close(close); }
- struct closer : public std::unary_function<streambuf_type*, void> {
+ struct closer {
+ typedef streambuf_type* argument_type;
+ typedef void result_type;
closer(BOOST_IOS::openmode m) : mode_(m) { }
void operator() (streambuf_type* b)
{
// Trivial Converter : used when (cv-unqualified) T == (cv-unqualified) S
//
template<class Traits>
- struct trivial_converter_impl : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
- ,BOOST_DEDUCED_TYPENAME Traits::result_type
- >
- ,public dummy_range_checker<Traits>
+ struct trivial_converter_impl : public dummy_range_checker<Traits>
{
typedef Traits traits ;
// Rounding Converter : used for float to integral conversions.
//
template<class Traits,class RangeChecker,class RawConverter,class Float2IntRounder>
- struct rounding_converter : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
- ,BOOST_DEDUCED_TYPENAME Traits::result_type
- >
- ,public RangeChecker
+ struct rounding_converter : public RangeChecker
,public Float2IntRounder
,public RawConverter
{
// Non-Rounding Converter : used for all other conversions.
//
template<class Traits,class RangeChecker,class RawConverter>
- struct non_rounding_converter : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
- ,BOOST_DEDUCED_TYPENAME Traits::result_type
- >
- ,public RangeChecker
+ struct non_rounding_converter : public RangeChecker
,public RawConverter
{
typedef RangeChecker RangeCheckerBase ;
class BOOST_SIGNALS2_SIGNAL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)
BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION: public signal_base,
public detail::BOOST_SIGNALS2_STD_FUNCTIONAL_BASE
- (typename detail::result_type_wrapper<typename Combiner::result_type>::type)
{
typedef detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)
<BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> impl_class;
#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION_DECL(arity) BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(arity)
#define BOOST_SIGNALS2_SIGNAL_TEMPLATE_SPECIALIZATION
-#define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(result_type) std_functional_base
+#define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE std_functional_base
#define BOOST_SIGNALS2_PP_COMMA_IF(arity) BOOST_PP_COMMA_IF(arity)
ExtendedSlotFunction, \
Mutex>
-#define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(result_type) \
- std_functional_base<result_type , Args...>
+#define BOOST_SIGNALS2_STD_FUNCTIONAL_BASE \
+ std_functional_base<Args...>
#define BOOST_SIGNALS2_PP_COMMA_IF(arity) ,
template<BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION_DECL(BOOST_SIGNALS2_NUM_ARGS)>
class BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS) BOOST_SIGNALS2_SLOT_TEMPLATE_SPECIALIZATION
- : public slot_base, public detail::BOOST_SIGNALS2_STD_FUNCTIONAL_BASE(R)
+ : public slot_base, public detail::BOOST_SIGNALS2_STD_FUNCTIONAL_BASE
{
public:
typedef typename variadic_arg_type<n - 1, Args...>::type type;
};
- template <typename R, typename ... Args>
+ template <typename ... Args>
struct std_functional_base
{};
- template <typename R, typename T1>
- struct std_functional_base<R, T1>: public std::unary_function<T1, R>
- {};
- template <typename R, typename T1, typename T2>
- struct std_functional_base<R, T1, T2>: public std::binary_function<T1, T2, R>
- {};
+ template <typename T1>
+ struct std_functional_base<T1>
+ {
+ typedef T1 argument_type;
+ };
+ template <typename T1, typename T2>
+ struct std_functional_base<T1, T2>
+ {
+ typedef T1 first_argument_type;
+ typedef T2 second_argument_type;
+ };
} // namespace detail
} // namespace signals2
} // namespace boost
// owner_less.hpp
//
// Copyright (c) 2008 Frank Mori Hess
+// Copyright (c) 2016 Peter Dimov
//
// 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)
//
-// See http://www.boost.org/libs/smart_ptr/smart_ptr.htm for documentation.
+// See http://www.boost.org/libs/smart_ptr/ for documentation.
//
-#include <functional>
-
namespace boost
{
- template<typename T> class shared_ptr;
- template<typename T> class weak_ptr;
-
- namespace detail
- {
- template<typename T, typename U>
- struct generic_owner_less : public std::binary_function<T, T, bool>
- {
- bool operator()(const T &lhs, const T &rhs) const
- {
- return lhs.owner_before(rhs);
- }
- bool operator()(const T &lhs, const U &rhs) const
- {
- return lhs.owner_before(rhs);
- }
- bool operator()(const U &lhs, const T &rhs) const
- {
- return lhs.owner_before(rhs);
- }
- };
- } // namespace detail
- template<typename T> struct owner_less;
-
- template<typename T>
- struct owner_less<shared_ptr<T> >:
- public detail::generic_owner_less<shared_ptr<T>, weak_ptr<T> >
- {};
+template<class T = void> struct owner_less
+{
+ typedef bool result_type;
+ typedef T first_argument_type;
+ typedef T second_argument_type;
- template<typename T>
- struct owner_less<weak_ptr<T> >:
- public detail::generic_owner_less<weak_ptr<T>, shared_ptr<T> >
- {};
+ template<class U, class V> bool operator()( U const & u, V const & v ) const
+ {
+ return u.owner_before( v );
+ }
+};
} // namespace boost
-#endif // #ifndef BOOST_SMART_PTR_OWNER_LESS_HPP_INCLUDED
+#endif // #ifndef BOOST_SMART_PTR_OWNER_LESS_HPP_INCLUDED
\ No newline at end of file
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+#ifndef BOOST_NO_CXX98_FUNCTION_BASE
BOOST_TYPEOF_REGISTER_TEMPLATE(std::unary_function, 2)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::binary_function, 3)
+#endif//BOOST_NO_CXX98_FUNCTION_BASE
BOOST_TYPEOF_REGISTER_TEMPLATE(std::plus, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::minus, 1)
BOOST_TYPEOF_REGISTER_TEMPLATE(std::multiplies, 1)
}
template<class OptionalPointee>
-struct equal_pointees_t : std::binary_function<OptionalPointee,OptionalPointee,bool>
+struct equal_pointees_t
{
+ typedef bool result_type;
+ typedef OptionalPointee first_argument_type;
+ typedef OptionalPointee second_argument_type;
+
bool operator() ( OptionalPointee const& x, OptionalPointee const& y ) const
{ return equal_pointees(x,y) ; }
} ;
// template<class OP> bool less_pointees(OP const& x, OP const& y);
-// template<class OP> struct less_pointees_t;
//
// Being OP a model of OptionalPointee (either a pointer or an optional):
//
}
template<class OptionalPointee>
-struct less_pointees_t : std::binary_function<OptionalPointee,OptionalPointee,bool>
+struct less_pointees_t
{
+ typedef bool result_type;
+ typedef OptionalPointee first_argument_type;
+ typedef OptionalPointee second_argument_type;
+
bool operator() ( OptionalPointee const& x, OptionalPointee const& y ) const
{ return less_pointees(x,y) ; }
} ;