Skip to content

Commit c5f6f52

Browse files
committed
Remove dependency on boost::mpl from 'clamp' and 'is_sorted'
1 parent c9077bd commit c5f6f52

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Diff for: include/boost/algorithm/clamp.hpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
#include <boost/config.hpp>
2727
#include <boost/range/begin.hpp>
2828
#include <boost/range/end.hpp>
29-
#include <boost/mpl/identity.hpp> // for identity
30-
#include <boost/utility/enable_if.hpp> // for boost::disable_if
29+
#include <boost/type_traits/type_identity.hpp> // for boost::type_identity
30+
#include <boost/utility/enable_if.hpp> // for boost::disable_if
3131

3232
namespace boost { namespace algorithm {
3333

3434
/// \fn clamp ( T const& val,
35-
/// typename boost::mpl::identity<T>::type const & lo,
36-
/// typename boost::mpl::identity<T>::type const & hi, Pred p )
35+
/// typename boost::type_identity<T>::type const & lo,
36+
/// typename boost::type_identity<T>::type const & hi, Pred p )
3737
/// \return the value "val" brought into the range [ lo, hi ]
3838
/// using the comparison predicate p.
3939
/// If p ( val, lo ) return lo.
@@ -48,17 +48,17 @@ namespace boost { namespace algorithm {
4848
///
4949
template<typename T, typename Pred>
5050
BOOST_CXX14_CONSTEXPR T const & clamp ( T const& val,
51-
typename boost::mpl::identity<T>::type const & lo,
52-
typename boost::mpl::identity<T>::type const & hi, Pred p )
51+
typename boost::type_identity<T>::type const & lo,
52+
typename boost::type_identity<T>::type const & hi, Pred p )
5353
{
5454
// assert ( !p ( hi, lo )); // Can't assert p ( lo, hi ) b/c they might be equal
5555
return p ( val, lo ) ? lo : p ( hi, val ) ? hi : val;
5656
}
5757

5858

5959
/// \fn clamp ( T const& val,
60-
/// typename boost::mpl::identity<T>::type const & lo,
61-
/// typename boost::mpl::identity<T>::type const & hi )
60+
/// typename boost::identity<T>::type const & lo,
61+
/// typename boost::identity<T>::type const & hi )
6262
/// \return the value "val" brought into the range [ lo, hi ].
6363
/// If the value is less than lo, return lo.
6464
/// If the value is greater than "hi", return hi.
@@ -70,8 +70,8 @@ namespace boost { namespace algorithm {
7070
///
7171
template<typename T>
7272
BOOST_CXX14_CONSTEXPR T const& clamp ( const T& val,
73-
typename boost::mpl::identity<T>::type const & lo,
74-
typename boost::mpl::identity<T>::type const & hi )
73+
typename boost::type_identity<T>::type const & lo,
74+
typename boost::type_identity<T>::type const & hi )
7575
{
7676
return boost::algorithm::clamp ( val, lo, hi, std::less<T>());
7777
}

Diff for: include/boost/algorithm/cxx11/is_sorted.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#include <boost/utility/enable_if.hpp>
2424
#include <boost/type_traits/is_same.hpp>
25-
#include <boost/mpl/identity.hpp>
25+
#include <boost/type_traits/type_identity.hpp> // for boost::type_identity
2626

2727
namespace boost { namespace algorithm {
2828

@@ -127,7 +127,7 @@ namespace boost { namespace algorithm {
127127
/// \param p A binary predicate that returns true if two elements are ordered.
128128
///
129129
template <typename R, typename Pred>
130-
BOOST_CXX14_CONSTEXPR typename boost::lazy_disable_if_c< boost::is_same<R, Pred>::value, boost::mpl::identity<bool> >::type
130+
BOOST_CXX14_CONSTEXPR typename boost::lazy_disable_if_c< boost::is_same<R, Pred>::value, boost::type_identity<bool> >::type
131131
is_sorted ( const R &range, Pred p )
132132
{
133133
return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range ), p );

0 commit comments

Comments
 (0)