diff --git a/include/boost/algorithm/algorithm.hpp b/include/boost/algorithm/algorithm.hpp index ab0d4af..96b3b48 100644 --- a/include/boost/algorithm/algorithm.hpp +++ b/include/boost/algorithm/algorithm.hpp @@ -40,7 +40,7 @@ T identity_operation ( std::plus ) { return T(0); } // \remark Taken from Knuth, The Art of Computer Programming, Volume 2: // Seminumerical Algorithms, Section 4.6.3 template -typename boost::enable_if, T>::type +BOOST_CXX14_CONSTEXPR typename boost::enable_if, T>::type power (T x, Integer n) { T y = 1; // Should be "T y{1};" if (n == 0) return y; @@ -67,7 +67,7 @@ power (T x, Integer n) { // \remark Taken from Knuth, The Art of Computer Programming, Volume 2: // Seminumerical Algorithms, Section 4.6.3 template -typename boost::enable_if, T>::type +BOOST_CXX14_CONSTEXPR typename boost::enable_if, T>::type power (T x, Integer n, Operation op) { T y = identity_operation(op); if (n == 0) return y; diff --git a/include/boost/algorithm/clamp.hpp b/include/boost/algorithm/clamp.hpp index 7bfa47e..a179d26 100644 --- a/include/boost/algorithm/clamp.hpp +++ b/include/boost/algorithm/clamp.hpp @@ -46,7 +46,7 @@ namespace boost { namespace algorithm { /// p ( a, b ) returns a boolean. /// template - T const & clamp ( T const& val, + BOOST_CXX14_CONSTEXPR T const & clamp ( T const& val, typename boost::mpl::identity::type const & lo, typename boost::mpl::identity::type const & hi, Pred p ) { @@ -68,7 +68,7 @@ namespace boost { namespace algorithm { /// \param hi The upper bound of the range to be clamped to /// template - T const& clamp ( const T& val, + BOOST_CXX14_CONSTEXPR T const& clamp ( const T& val, typename boost::mpl::identity::type const & lo, typename boost::mpl::identity::type const & hi ) { @@ -87,7 +87,7 @@ namespace boost { namespace algorithm { /// \param hi The upper bound of the range to be clamped to /// template - OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out, + BOOST_CXX14_CONSTEXPR OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out, typename std::iterator_traits::value_type const & lo, typename std::iterator_traits::value_type const & hi ) { @@ -108,7 +108,7 @@ namespace boost { namespace algorithm { /// \param hi The upper bound of the range to be clamped to /// template - typename boost::disable_if_c::value, OutputIterator>::type + BOOST_CXX14_CONSTEXPR typename boost::disable_if_c::value, OutputIterator>::type clamp_range ( const Range &r, OutputIterator out, typename std::iterator_traits::type>::value_type const & lo, typename std::iterator_traits::type>::value_type const & hi ) @@ -133,7 +133,7 @@ namespace boost { namespace algorithm { /// template - OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out, + BOOST_CXX14_CONSTEXPR OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out, typename std::iterator_traits::value_type const & lo, typename std::iterator_traits::value_type const & hi, Pred p ) { @@ -160,7 +160,7 @@ namespace boost { namespace algorithm { // Disable this template if the first two parameters are the same type; // In that case, the user will get the two iterator version. template - typename boost::disable_if_c::value, OutputIterator>::type + BOOST_CXX14_CONSTEXPR typename boost::disable_if_c::value, OutputIterator>::type clamp_range ( const Range &r, OutputIterator out, typename std::iterator_traits::type>::value_type const & lo, typename std::iterator_traits::type>::value_type const & hi, diff --git a/include/boost/algorithm/cxx11/all_of.hpp b/include/boost/algorithm/cxx11/all_of.hpp index 39cab39..ae8ca9f 100644 --- a/include/boost/algorithm/cxx11/all_of.hpp +++ b/include/boost/algorithm/cxx11/all_of.hpp @@ -30,7 +30,7 @@ namespace boost { namespace algorithm { /// We will use the standard one if it is available, /// otherwise we have our own implementation. template -bool all_of ( InputIterator first, InputIterator last, Predicate p ) +BOOST_CXX14_CONSTEXPR bool all_of ( InputIterator first, InputIterator last, Predicate p ) { for ( ; first != last; ++first ) if ( !p(*first)) @@ -46,7 +46,7 @@ bool all_of ( InputIterator first, InputIterator last, Predicate p ) /// \param p A predicate for testing the elements of the range /// template -bool all_of ( const Range &r, Predicate p ) +BOOST_CXX14_CONSTEXPR bool all_of ( const Range &r, Predicate p ) { return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p ); } @@ -60,7 +60,7 @@ bool all_of ( const Range &r, Predicate p ) /// \param val A value to compare against /// template -bool all_of_equal ( InputIterator first, InputIterator last, const T &val ) +BOOST_CXX14_CONSTEXPR bool all_of_equal ( InputIterator first, InputIterator last, const T &val ) { for ( ; first != last; ++first ) if ( val != *first ) @@ -76,7 +76,7 @@ bool all_of_equal ( InputIterator first, InputIterator last, const T &val ) /// \param val A value to compare against /// template -bool all_of_equal ( const Range &r, const T &val ) +BOOST_CXX14_CONSTEXPR bool all_of_equal ( const Range &r, const T &val ) { return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val ); } diff --git a/include/boost/algorithm/cxx11/any_of.hpp b/include/boost/algorithm/cxx11/any_of.hpp index cf69348..6d30d08 100644 --- a/include/boost/algorithm/cxx11/any_of.hpp +++ b/include/boost/algorithm/cxx11/any_of.hpp @@ -29,7 +29,7 @@ namespace boost { namespace algorithm { /// \param p A predicate for testing the elements of the sequence /// template -bool any_of ( InputIterator first, InputIterator last, Predicate p ) +BOOST_CXX14_CONSTEXPR bool any_of ( InputIterator first, InputIterator last, Predicate p ) { for ( ; first != last; ++first ) if ( p(*first)) @@ -45,7 +45,7 @@ bool any_of ( InputIterator first, InputIterator last, Predicate p ) /// \param p A predicate for testing the elements of the range /// template -bool any_of ( const Range &r, Predicate p ) +BOOST_CXX14_CONSTEXPR bool any_of ( const Range &r, Predicate p ) { return boost::algorithm::any_of (boost::begin (r), boost::end (r), p); } @@ -59,7 +59,7 @@ bool any_of ( const Range &r, Predicate p ) /// \param val A value to compare against /// template -bool any_of_equal ( InputIterator first, InputIterator last, const V &val ) +BOOST_CXX14_CONSTEXPR bool any_of_equal ( InputIterator first, InputIterator last, const V &val ) { for ( ; first != last; ++first ) if ( val == *first ) @@ -75,7 +75,7 @@ bool any_of_equal ( InputIterator first, InputIterator last, const V &val ) /// \param val A value to compare against /// template -bool any_of_equal ( const Range &r, const V &val ) +BOOST_CXX14_CONSTEXPR bool any_of_equal ( const Range &r, const V &val ) { return boost::algorithm::any_of_equal (boost::begin (r), boost::end (r), val); } diff --git a/include/boost/algorithm/cxx11/copy_if.hpp b/include/boost/algorithm/cxx11/copy_if.hpp index d869caf..ec311e7 100644 --- a/include/boost/algorithm/cxx11/copy_if.hpp +++ b/include/boost/algorithm/cxx11/copy_if.hpp @@ -31,7 +31,7 @@ namespace boost { namespace algorithm { /// We will use the standard one if it is available, /// otherwise we have our own implementation. template -OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) +BOOST_CXX14_CONSTEXPR OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) { for ( ; first != last; ++first ) if (p(*first)) @@ -49,7 +49,7 @@ OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator /// \param p A predicate for testing the elements of the range /// template -OutputIterator copy_if ( const Range &r, OutputIterator result, Predicate p ) +BOOST_CXX14_CONSTEXPR OutputIterator copy_if ( const Range &r, OutputIterator result, Predicate p ) { return boost::algorithm::copy_if (boost::begin (r), boost::end(r), result, p); } @@ -66,7 +66,7 @@ OutputIterator copy_if ( const Range &r, OutputIterator result, Predicate p ) /// \param p A predicate for testing the elements of the range /// template -std::pair +BOOST_CXX14_CONSTEXPR std::pair copy_while ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) { for ( ; first != last && p(*first); ++first ) @@ -84,7 +84,7 @@ copy_while ( InputIterator first, InputIterator last, OutputIterator result, Pre /// \param p A predicate for testing the elements of the range /// template -std::pair::type, OutputIterator> +BOOST_CXX14_CONSTEXPR std::pair::type, OutputIterator> copy_while ( const Range &r, OutputIterator result, Predicate p ) { return boost::algorithm::copy_while (boost::begin (r), boost::end(r), result, p); @@ -102,7 +102,7 @@ copy_while ( const Range &r, OutputIterator result, Predicate p ) /// \param p A predicate for testing the elements of the range /// template -std::pair +BOOST_CXX14_CONSTEXPR std::pair copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p ) { for ( ; first != last && !p(*first); ++first ) @@ -120,7 +120,7 @@ copy_until ( InputIterator first, InputIterator last, OutputIterator result, Pre /// \param p A predicate for testing the elements of the range /// template -std::pair::type, OutputIterator> +BOOST_CXX14_CONSTEXPR std::pair::type, OutputIterator> copy_until ( const Range &r, OutputIterator result, Predicate p ) { return boost::algorithm::copy_until (boost::begin (r), boost::end(r), result, p); diff --git a/include/boost/algorithm/cxx11/copy_n.hpp b/include/boost/algorithm/cxx11/copy_n.hpp index ebfe889..842718f 100644 --- a/include/boost/algorithm/cxx11/copy_n.hpp +++ b/include/boost/algorithm/cxx11/copy_n.hpp @@ -28,7 +28,7 @@ namespace boost { namespace algorithm { /// We will use the standard one if it is available, /// otherwise we have our own implementation. template -OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result ) +BOOST_CXX14_CONSTEXPR OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result ) { for ( ; n > 0; --n, ++first, ++result ) *result = *first; diff --git a/include/boost/algorithm/cxx11/find_if_not.hpp b/include/boost/algorithm/cxx11/find_if_not.hpp index 414697c..735c719 100644 --- a/include/boost/algorithm/cxx11/find_if_not.hpp +++ b/include/boost/algorithm/cxx11/find_if_not.hpp @@ -30,7 +30,7 @@ namespace boost { namespace algorithm { /// We will use the standard one if it is available, /// otherwise we have our own implementation. template -InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p ) +BOOST_CXX14_CONSTEXPR InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p ) { for ( ; first != last; ++first ) if ( !p(*first)) @@ -46,7 +46,7 @@ InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p /// \param p A predicate for testing the elements of the range /// template -typename boost::range_iterator::type find_if_not ( const Range &r, Predicate p ) +BOOST_CXX14_CONSTEXPR typename boost::range_iterator::type find_if_not ( const Range &r, Predicate p ) { return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p); } diff --git a/include/boost/algorithm/cxx11/iota.hpp b/include/boost/algorithm/cxx11/iota.hpp index 2e638ec..0cfffb7 100644 --- a/include/boost/algorithm/cxx11/iota.hpp +++ b/include/boost/algorithm/cxx11/iota.hpp @@ -29,7 +29,7 @@ namespace boost { namespace algorithm { /// We will use the standard one if it is available, /// otherwise we have our own implementation. template -void iota ( ForwardIterator first, ForwardIterator last, T value ) +BOOST_CXX14_CONSTEXPR void iota ( ForwardIterator first, ForwardIterator last, T value ) { for ( ; first != last; ++first, ++value ) *first = value; @@ -42,7 +42,7 @@ void iota ( ForwardIterator first, ForwardIterator last, T value ) /// \param value The initial value of the sequence to be generated /// template -void iota ( Range &r, T value ) +BOOST_CXX14_CONSTEXPR void iota ( Range &r, T value ) { boost::algorithm::iota (boost::begin(r), boost::end(r), value); } @@ -56,7 +56,7 @@ void iota ( Range &r, T value ) /// \param n The number of items to write /// template -OutputIterator iota_n ( OutputIterator out, T value, std::size_t n ) +BOOST_CXX14_CONSTEXPR OutputIterator iota_n ( OutputIterator out, T value, std::size_t n ) { for ( ; n > 0; --n, ++value ) *out++ = value; diff --git a/include/boost/algorithm/cxx11/is_partitioned.hpp b/include/boost/algorithm/cxx11/is_partitioned.hpp index cdabd97..2d9236e 100644 --- a/include/boost/algorithm/cxx11/is_partitioned.hpp +++ b/include/boost/algorithm/cxx11/is_partitioned.hpp @@ -29,7 +29,7 @@ namespace boost { namespace algorithm { /// We will use the standard one if it is available, /// otherwise we have our own implementation. template -bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p ) +BOOST_CXX14_CONSTEXPR bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p ) { // Run through the part that satisfy the predicate for ( ; first != last; ++first ) @@ -49,7 +49,7 @@ bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p /// \param p The predicate to test the values with /// template -bool is_partitioned ( const Range &r, UnaryPredicate p ) +BOOST_CXX14_CONSTEXPR bool is_partitioned ( const Range &r, UnaryPredicate p ) { return boost::algorithm::is_partitioned (boost::begin(r), boost::end(r), p); } diff --git a/include/boost/algorithm/cxx11/is_sorted.hpp b/include/boost/algorithm/cxx11/is_sorted.hpp index f6062da..a0770f1 100644 --- a/include/boost/algorithm/cxx11/is_sorted.hpp +++ b/include/boost/algorithm/cxx11/is_sorted.hpp @@ -35,7 +35,7 @@ namespace boost { namespace algorithm { /// \param p A binary predicate that returns true if two elements are ordered. /// template - ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last, Pred p ) + BOOST_CXX14_CONSTEXPR ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last, Pred p ) { if ( first == last ) return last; // the empty sequence is ordered ForwardIterator next = first; @@ -55,7 +55,7 @@ namespace boost { namespace algorithm { /// \param last One past the end of the sequence /// template - ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last ) + BOOST_CXX14_CONSTEXPR ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last ) { typedef typename std::iterator_traits::value_type value_type; return boost::algorithm::is_sorted_until ( first, last, std::less()); @@ -70,7 +70,7 @@ namespace boost { namespace algorithm { /// \param p A binary predicate that returns true if two elements are ordered. /// template - bool is_sorted ( ForwardIterator first, ForwardIterator last, Pred p ) + BOOST_CXX14_CONSTEXPR bool is_sorted ( ForwardIterator first, ForwardIterator last, Pred p ) { return boost::algorithm::is_sorted_until (first, last, p) == last; } @@ -82,7 +82,7 @@ namespace boost { namespace algorithm { /// \param last One past the end of the sequence /// template - bool is_sorted ( ForwardIterator first, ForwardIterator last ) + BOOST_CXX14_CONSTEXPR bool is_sorted ( ForwardIterator first, ForwardIterator last ) { return boost::algorithm::is_sorted_until (first, last) == last; } @@ -99,7 +99,7 @@ namespace boost { namespace algorithm { /// \param p A binary predicate that returns true if two elements are ordered. /// template - typename boost::lazy_disable_if_c< + BOOST_CXX14_CONSTEXPR typename boost::lazy_disable_if_c< boost::is_same::value, typename boost::range_iterator >::type is_sorted_until ( const R &range, Pred p ) @@ -114,7 +114,7 @@ namespace boost { namespace algorithm { /// \param range The range to be tested. /// template - typename boost::range_iterator::type is_sorted_until ( const R &range ) + BOOST_CXX14_CONSTEXPR typename boost::range_iterator::type is_sorted_until ( const R &range ) { return boost::algorithm::is_sorted_until ( boost::begin ( range ), boost::end ( range )); } @@ -127,7 +127,7 @@ namespace boost { namespace algorithm { /// \param p A binary predicate that returns true if two elements are ordered. /// template - typename boost::lazy_disable_if_c< boost::is_same::value, boost::mpl::identity >::type + BOOST_CXX14_CONSTEXPR typename boost::lazy_disable_if_c< boost::is_same::value, boost::mpl::identity >::type is_sorted ( const R &range, Pred p ) { return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range ), p ); @@ -140,7 +140,7 @@ namespace boost { namespace algorithm { /// \param range The range to be tested. /// template - bool is_sorted ( const R &range ) + BOOST_CXX14_CONSTEXPR bool is_sorted ( const R &range ) { return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range )); } @@ -160,7 +160,7 @@ namespace boost { namespace algorithm { /// \note This function will return true for sequences that contain items that compare /// equal. If that is not what you intended, you should use is_strictly_increasing instead. template - bool is_increasing ( ForwardIterator first, ForwardIterator last ) + BOOST_CXX14_CONSTEXPR bool is_increasing ( ForwardIterator first, ForwardIterator last ) { typedef typename std::iterator_traits::value_type value_type; return boost::algorithm::is_sorted (first, last, std::less()); @@ -176,7 +176,7 @@ namespace boost { namespace algorithm { /// \note This function will return true for sequences that contain items that compare /// equal. If that is not what you intended, you should use is_strictly_increasing instead. template - bool is_increasing ( const R &range ) + BOOST_CXX14_CONSTEXPR bool is_increasing ( const R &range ) { return is_increasing ( boost::begin ( range ), boost::end ( range )); } @@ -193,7 +193,7 @@ namespace boost { namespace algorithm { /// \note This function will return true for sequences that contain items that compare /// equal. If that is not what you intended, you should use is_strictly_decreasing instead. template - bool is_decreasing ( ForwardIterator first, ForwardIterator last ) + BOOST_CXX14_CONSTEXPR bool is_decreasing ( ForwardIterator first, ForwardIterator last ) { typedef typename std::iterator_traits::value_type value_type; return boost::algorithm::is_sorted (first, last, std::greater()); @@ -208,7 +208,7 @@ namespace boost { namespace algorithm { /// \note This function will return true for sequences that contain items that compare /// equal. If that is not what you intended, you should use is_strictly_decreasing instead. template - bool is_decreasing ( const R &range ) + BOOST_CXX14_CONSTEXPR bool is_decreasing ( const R &range ) { return is_decreasing ( boost::begin ( range ), boost::end ( range )); } @@ -225,7 +225,7 @@ namespace boost { namespace algorithm { /// \note This function will return false for sequences that contain items that compare /// equal. If that is not what you intended, you should use is_increasing instead. template - bool is_strictly_increasing ( ForwardIterator first, ForwardIterator last ) + BOOST_CXX14_CONSTEXPR bool is_strictly_increasing ( ForwardIterator first, ForwardIterator last ) { typedef typename std::iterator_traits::value_type value_type; return boost::algorithm::is_sorted (first, last, std::less_equal()); @@ -240,7 +240,7 @@ namespace boost { namespace algorithm { /// \note This function will return false for sequences that contain items that compare /// equal. If that is not what you intended, you should use is_increasing instead. template - bool is_strictly_increasing ( const R &range ) + BOOST_CXX14_CONSTEXPR bool is_strictly_increasing ( const R &range ) { return is_strictly_increasing ( boost::begin ( range ), boost::end ( range )); } @@ -256,7 +256,7 @@ namespace boost { namespace algorithm { /// \note This function will return false for sequences that contain items that compare /// equal. If that is not what you intended, you should use is_decreasing instead. template - bool is_strictly_decreasing ( ForwardIterator first, ForwardIterator last ) + BOOST_CXX14_CONSTEXPR bool is_strictly_decreasing ( ForwardIterator first, ForwardIterator last ) { typedef typename std::iterator_traits::value_type value_type; return boost::algorithm::is_sorted (first, last, std::greater_equal()); @@ -271,7 +271,7 @@ namespace boost { namespace algorithm { /// \note This function will return false for sequences that contain items that compare /// equal. If that is not what you intended, you should use is_decreasing instead. template - bool is_strictly_decreasing ( const R &range ) + BOOST_CXX14_CONSTEXPR bool is_strictly_decreasing ( const R &range ) { return is_strictly_decreasing ( boost::begin ( range ), boost::end ( range )); } diff --git a/include/boost/algorithm/cxx11/none_of.hpp b/include/boost/algorithm/cxx11/none_of.hpp index 67be3d1..cf02e86 100644 --- a/include/boost/algorithm/cxx11/none_of.hpp +++ b/include/boost/algorithm/cxx11/none_of.hpp @@ -27,7 +27,7 @@ namespace boost { namespace algorithm { /// \param p A predicate for testing the elements of the sequence /// template -bool none_of ( InputIterator first, InputIterator last, Predicate p ) +BOOST_CXX14_CONSTEXPR bool none_of ( InputIterator first, InputIterator last, Predicate p ) { for ( ; first != last; ++first ) if ( p(*first)) @@ -43,7 +43,7 @@ for ( ; first != last; ++first ) /// \param p A predicate for testing the elements of the range /// template -bool none_of ( const Range &r, Predicate p ) +BOOST_CXX14_CONSTEXPR bool none_of ( const Range &r, Predicate p ) { return boost::algorithm::none_of (boost::begin (r), boost::end (r), p ); } @@ -57,7 +57,7 @@ bool none_of ( const Range &r, Predicate p ) /// \param val A value to compare against /// template -bool none_of_equal ( InputIterator first, InputIterator last, const V &val ) +BOOST_CXX14_CONSTEXPR bool none_of_equal ( InputIterator first, InputIterator last, const V &val ) { for ( ; first != last; ++first ) if ( val == *first ) @@ -73,7 +73,7 @@ bool none_of_equal ( InputIterator first, InputIterator last, const V &val ) /// \param val A value to compare against /// template -bool none_of_equal ( const Range &r, const V & val ) +BOOST_CXX14_CONSTEXPR bool none_of_equal ( const Range &r, const V & val ) { return boost::algorithm::none_of_equal (boost::begin (r), boost::end (r), val); } diff --git a/include/boost/algorithm/cxx11/one_of.hpp b/include/boost/algorithm/cxx11/one_of.hpp index b6e8c77..f4e2b38 100644 --- a/include/boost/algorithm/cxx11/one_of.hpp +++ b/include/boost/algorithm/cxx11/one_of.hpp @@ -28,7 +28,7 @@ namespace boost { namespace algorithm { /// \param p A predicate for testing the elements of the sequence /// template -bool one_of ( InputIterator first, InputIterator last, Predicate p ) +BOOST_CXX14_CONSTEXPR bool one_of ( InputIterator first, InputIterator last, Predicate p ) { InputIterator i = std::find_if (first, last, p); if (i == last) @@ -43,7 +43,7 @@ bool one_of ( InputIterator first, InputIterator last, Predicate p ) /// \param p A predicate for testing the elements of the range /// template -bool one_of ( const Range &r, Predicate p ) +BOOST_CXX14_CONSTEXPR bool one_of ( const Range &r, Predicate p ) { return boost::algorithm::one_of ( boost::begin (r), boost::end (r), p ); } diff --git a/include/boost/algorithm/cxx11/partition_copy.hpp b/include/boost/algorithm/cxx11/partition_copy.hpp index 2d8c3e9..20c939f 100644 --- a/include/boost/algorithm/cxx11/partition_copy.hpp +++ b/include/boost/algorithm/cxx11/partition_copy.hpp @@ -15,6 +15,7 @@ #include // for std::partition_copy, if available #include // for make_pair +#include #include #include @@ -38,7 +39,7 @@ namespace boost { namespace algorithm { /// otherwise we have our own implementation. template -std::pair +BOOST_CXX14_CONSTEXPR std::pair partition_copy ( InputIterator first, InputIterator last, OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p ) { @@ -60,7 +61,7 @@ partition_copy ( InputIterator first, InputIterator last, /// template -std::pair +BOOST_CXX14_CONSTEXPR std::pair partition_copy ( const Range &r, OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p ) { diff --git a/include/boost/algorithm/cxx14/equal.hpp b/include/boost/algorithm/cxx14/equal.hpp index cfc62d5..78587fc 100644 --- a/include/boost/algorithm/cxx14/equal.hpp +++ b/include/boost/algorithm/cxx14/equal.hpp @@ -21,7 +21,7 @@ namespace detail { template struct eq : public std::binary_function { - bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;} + BOOST_CONSTEXPR bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;} }; template @@ -37,7 +37,7 @@ namespace detail { } template - bool equal ( InputIterator1 first1, InputIterator1 last1, + BOOST_CXX14_CONSTEXPR bool equal ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred, std::input_iterator_tag, std::input_iterator_tag ) { diff --git a/include/boost/algorithm/cxx14/mismatch.hpp b/include/boost/algorithm/cxx14/mismatch.hpp index 926ab19..33cd609 100644 --- a/include/boost/algorithm/cxx14/mismatch.hpp +++ b/include/boost/algorithm/cxx14/mismatch.hpp @@ -14,6 +14,7 @@ #include // for std::mismatch #include // for std::pair +#include namespace boost { namespace algorithm { @@ -28,7 +29,7 @@ namespace boost { namespace algorithm { /// \param last2 One past the end of the second range. /// \param pred A predicate for comparing the elements of the ranges template -std::pair mismatch ( +BOOST_CXX14_CONSTEXPR std::pair mismatch ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred ) @@ -48,7 +49,7 @@ std::pair mismatch ( /// \param first2 The start of the second range. /// \param last2 One past the end of the second range. template -std::pair mismatch ( +BOOST_CXX14_CONSTEXPR std::pair mismatch ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2 ) { diff --git a/test/all_of_test.cpp b/test/all_of_test.cpp index 36918d5..79e25a2 100644 --- a/test/all_of_test.cpp +++ b/test/all_of_test.cpp @@ -19,9 +19,9 @@ template struct is_ : public std::unary_function { - is_ ( T v ) : val_ ( v ) {} - ~is_ () {} - bool operator () ( T comp ) const { return val_ == comp; } + BOOST_CXX14_CONSTEXPR is_ ( T v ) : val_ ( v ) {} + + BOOST_CXX14_CONSTEXPR bool operator () ( T comp ) const { return val_ == comp; } private: is_ (); // need a value @@ -33,7 +33,7 @@ namespace ba = boost::algorithm; void test_all () { // Note: The literal values here are tested against directly, careful if you change them: - int some_numbers[] = { 1, 1, 1, 18, 10 }; + BOOST_CXX14_CONSTEXPR int some_numbers[] = { 1, 1, 1, 18, 10 }; std::vector vi(some_numbers, some_numbers + 5); std::list li(vi.begin(), vi.end ()); @@ -77,7 +77,14 @@ void test_all () l_iter++; l_iter++; l_iter++; BOOST_CHECK ( ba::all_of_equal ( li.begin(), l_iter, 1 )); BOOST_CHECK ( ba::all_of ( li.begin(), l_iter, is_ ( 1 ))); - + + BOOST_CXX14_CONSTEXPR bool constexpr_res = ( + !ba::all_of_equal ( some_numbers, 1 ) + && !ba::all_of ( some_numbers, is_ ( 1 )) + && ba::all_of_equal ( some_numbers, some_numbers + 3, 1 ) + && ba::all_of ( some_numbers, some_numbers + 3, is_ ( 1 )) + ); + BOOST_CHECK ( constexpr_res ); } diff --git a/test/any_of_test.cpp b/test/any_of_test.cpp index a3267c5..6193a2f 100644 --- a/test/any_of_test.cpp +++ b/test/any_of_test.cpp @@ -19,9 +19,9 @@ template struct is_ : public std::unary_function { - is_ ( T v ) : val_ ( v ) {} - ~is_ () {} - bool operator () ( T comp ) const { return val_ == comp; } + BOOST_CXX14_CONSTEXPR is_ ( T v ) : val_ ( v ) {} + + BOOST_CXX14_CONSTEXPR bool operator () ( T comp ) const { return val_ == comp; } private: is_ (); // need a value @@ -33,7 +33,7 @@ namespace ba = boost::algorithm; void test_any () { // Note: The literal values here are tested against directly, careful if you change them: - int some_numbers[] = { 1, 5, 0, 18, 10 }; + BOOST_CXX14_CONSTEXPR int some_numbers[] = { 1, 5, 0, 18, 10 }; std::vector vi(some_numbers, some_numbers + 5); std::list li(vi.begin(), vi.end ()); @@ -97,6 +97,15 @@ void test_any () BOOST_CHECK ( ba::any_of ( li.begin(), l_iter, is_ ( 5 ))); BOOST_CHECK (!ba::any_of_equal ( li.begin(), l_iter, 18 )); BOOST_CHECK (!ba::any_of ( li.begin(), l_iter, is_ ( 18 ))); + + + BOOST_CXX14_CONSTEXPR bool constexpr_res = ( + ba::any_of_equal ( some_numbers, 1 ) + && ba::any_of ( some_numbers, is_ ( 1 )) + && !ba::any_of_equal ( some_numbers, some_numbers + 3, 777 ) + && !ba::any_of ( some_numbers, some_numbers + 3, is_ ( 777 )) + ); + BOOST_CHECK ( constexpr_res ); } diff --git a/test/clamp_test.cpp b/test/clamp_test.cpp index 3519659..a8aacc7 100644 --- a/test/clamp_test.cpp +++ b/test/clamp_test.cpp @@ -45,6 +45,10 @@ void test_ints() BOOST_CHECK_EQUAL ( 1, ba::clamp ( 0, 1, 10 )); BOOST_CHECK_EQUAL ( 10, ba::clamp ( 10, 1, 10 )); BOOST_CHECK_EQUAL ( 10, ba::clamp ( 11, 1, 10 )); + BOOST_CXX14_CONSTEXPR bool constexpr_res = ( + ba::clamp ( 3, 1, 10 ) == 3 + ); + BOOST_CHECK( constexpr_res ); BOOST_CHECK_EQUAL ( 3, ba::clamp ( 3, 10, 1, intGreater )); BOOST_CHECK_EQUAL ( 1, ba::clamp ( 1, 10, 1, intGreater )); diff --git a/test/copy_if_test1.cpp b/test/copy_if_test1.cpp index 59944bc..1e093fd 100644 --- a/test/copy_if_test1.cpp +++ b/test/copy_if_test1.cpp @@ -25,10 +25,25 @@ namespace ba = boost::algorithm; // namespace ba = boost; -bool is_true ( int v ) { return true; } -bool is_false ( int v ) { return false; } -bool is_even ( int v ) { return v % 2 == 0; } -bool is_odd ( int v ) { return v % 2 == 1; } +BOOST_CXX14_CONSTEXPR bool is_true ( int v ) { return true; } +BOOST_CXX14_CONSTEXPR bool is_false ( int v ) { return false; } +BOOST_CXX14_CONSTEXPR bool is_even ( int v ) { return v % 2 == 0; } +BOOST_CXX14_CONSTEXPR bool is_odd ( int v ) { return v % 2 == 1; } + +BOOST_CXX14_CONSTEXPR inline bool constexpr_helper(const int* from, const int* to) { + bool res = true; + + int out_data[64] = {0}; + int* out = out_data; + ba::copy_if ( from, to, out, is_false); + + res = (res && out == out_data); + ba::copy_if ( from, to, out, is_true); + + res = (res && out == out_data + (to - from)); + + return res; +} template void test_copy_if ( Container const &c ) { @@ -164,6 +179,9 @@ void test_sequence1 () { test_copy_while ( v ); test_copy_until ( v ); + BOOST_CXX14_CONSTEXPR bool constexpr_res = constexpr_helper(0, 0); + BOOST_CHECK ( constexpr_res ); + std::list l; for ( int i = 25; i > 15; --i ) l.push_back ( i );