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

@ -19,9 +19,9 @@
template<typename T>
struct is_ : public std::unary_function<T, bool> {
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_one ()
{
// Note: The literal values here are tested against directly, careful if you change them:
int some_numbers[] = { 1, 1, 2, 3, 5 };
BOOST_CXX14_CONSTEXPR int some_numbers[] = { 1, 1, 2, 3, 5 };
std::vector<int> vi(some_numbers, some_numbers + 5);
std::list<int> li(vi.begin(), vi.end ());
@ -92,7 +92,13 @@ void test_one ()
BOOST_CHECK ( ba::one_of ( li.begin(), l_iter, is_<int> ( 2 )));
BOOST_CHECK (!ba::one_of_equal ( li.begin(), l_iter, 3 ));
BOOST_CHECK (!ba::one_of ( li.begin(), l_iter, is_<int> ( 3 )));
BOOST_CXX14_CONSTEXPR bool constexpr_res = (
!ba::one_of ( some_numbers, is_<int> ( 6 ))
&& ba::one_of ( some_numbers, some_numbers + 3, is_<int> ( 1 ))
);
BOOST_CHECK ( constexpr_res );
}