Updated constexpr tests for all affected modules. Added conditional constexpr to equal, which uses std::distance.

This commit is contained in:
MMaximoff
2017-04-07 22:31:23 +03:00
parent 8d095e9d30
commit dfa332e915
15 changed files with 625 additions and 185 deletions

View File

@ -15,6 +15,13 @@
#include <algorithm> // for std::equal
#include <functional> // for std::equal_to
#ifdef __cpp_lib_array_constexpr // or cpp17 compiler
// if compiled according to C++17 standard or std functions are constexpr
#define BOOST_CONSTEXPR_IF_STD_CONSTEXPR constexpr
#else
#define BOOST_CONSTEXPR_IF_STD_CONSTEXPR
#endif
namespace boost { namespace algorithm {
namespace detail {
@ -25,6 +32,7 @@ namespace detail {
};
template <class RandomAccessIterator1, class RandomAccessIterator2, class BinaryPredicate>
BOOST_CONSTEXPR_IF_STD_CONSTEXPR
bool equal ( RandomAccessIterator1 first1, RandomAccessIterator1 last1,
RandomAccessIterator2 first2, RandomAccessIterator2 last2, BinaryPredicate pred,
std::random_access_iterator_tag, std::random_access_iterator_tag )
@ -37,7 +45,8 @@ namespace detail {
}
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
BOOST_CXX14_CONSTEXPR 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 )
{
@ -60,6 +69,7 @@ namespace detail {
/// \param last2 One past the end of the second range.
/// \param pred A predicate for comparing the elements of the ranges
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
BOOST_CXX14_CONSTEXPR
bool equal ( InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred )
{
@ -78,6 +88,7 @@ bool equal ( InputIterator1 first1, InputIterator1 last1,
/// \param first2 The start of the second range.
/// \param last2 One past the end of the second range.
template <class InputIterator1, class InputIterator2>
BOOST_CXX14_CONSTEXPR
bool equal ( InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2 )
{