mirror of
https://github.com/boostorg/mp11.git
synced 2025-12-04 07:49:20 +01:00
Add mp_pairwise_fold
This commit is contained in:
18
test/mp_pairwise_fold_q.cpp
Normal file
18
test/mp_pairwise_fold_q.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright 2020 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/mp11.hpp>
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
|
||||
using namespace boost::mp11;
|
||||
|
||||
template<class L> using is_sorted = mp_none_of<mp_pairwise_fold_q<L, mp_bind<mp_less, _2, _1>>, mp_to_bool>;
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_TRAIT_TRUE((is_sorted<mp_list<mp_int<0>, mp_int<0>, mp_int<1>, mp_int<3>, mp_int<3>, mp_int<7>>>));
|
||||
BOOST_TEST_TRAIT_FALSE((is_sorted<mp_list<mp_int<0>, mp_int<0>, mp_int<1>, mp_int<3>, mp_int<3>, mp_int<2>>>));
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user