forked from boostorg/mp11
Merge branch 'develop'
This commit is contained in:
102
.travis.yml
Normal file
102
.travis.yml
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
# Copyright 2016 Peter Dimov
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
language: cpp
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
|
||||||
|
python: "2.7"
|
||||||
|
|
||||||
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
|
||||||
|
env:
|
||||||
|
matrix:
|
||||||
|
- BOGUS_JOB=true
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.9
|
||||||
|
- g++-5
|
||||||
|
- g++-6
|
||||||
|
- clang-3.6
|
||||||
|
- clang-3.7
|
||||||
|
- clang-3.8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise
|
||||||
|
- llvm-toolchain-precise-3.6
|
||||||
|
- llvm-toolchain-precise-3.7
|
||||||
|
- llvm-toolchain-precise-3.8
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- env: BOGUS_JOB=true
|
||||||
|
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++14
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++1z
|
||||||
|
|
||||||
|
- os: osx
|
||||||
|
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
|
||||||
|
|
||||||
|
- os: osx
|
||||||
|
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14
|
||||||
|
|
||||||
|
install:
|
||||||
|
- cd ..
|
||||||
|
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
- cd boost-root
|
||||||
|
- git submodule update --init --depth 1 tools/build
|
||||||
|
- git submodule update --init --depth 1 libs/config
|
||||||
|
- git submodule update --init --depth 1 tools/boostdep
|
||||||
|
- mkdir libs/mp11
|
||||||
|
- cp -r $TRAVIS_BUILD_DIR/* libs/mp11
|
||||||
|
- python tools/boostdep/depinst/depinst.py mp11
|
||||||
|
- ./bootstrap.sh
|
||||||
|
- ./b2 headers
|
||||||
|
|
||||||
|
script:
|
||||||
|
- |-
|
||||||
|
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
|
||||||
|
- ./b2 libs/mp11/test toolset=$TOOLSET
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
on_success: always
|
@@ -12,7 +12,7 @@
|
|||||||
#include <boost/mp11/set.hpp>
|
#include <boost/mp11/set.hpp>
|
||||||
#include <boost/mp11/integral.hpp>
|
#include <boost/mp11/integral.hpp>
|
||||||
#include <boost/mp11/utility.hpp>
|
#include <boost/mp11/utility.hpp>
|
||||||
#include <boost/mp11/detail/mp_plus.hpp>
|
#include <boost/mp11/function.hpp>
|
||||||
#include <boost/mp11/detail/mp_map_find.hpp>
|
#include <boost/mp11/detail/mp_map_find.hpp>
|
||||||
#include <boost/mp11/detail/config.hpp>
|
#include <boost/mp11/detail/config.hpp>
|
||||||
#include <boost/integer_sequence.hpp>
|
#include <boost/integer_sequence.hpp>
|
||||||
@@ -796,8 +796,13 @@ template<template<class...> class L, class... T> struct mp_unique_impl<L<T...>>
|
|||||||
template<class L> using mp_unique = typename detail::mp_unique_impl<L>::type;
|
template<class L> using mp_unique = typename detail::mp_unique_impl<L>::type;
|
||||||
|
|
||||||
// mp_all_of<L, P>
|
// mp_all_of<L, P>
|
||||||
|
template<class L, template<class...> class P> using mp_all_of = mp_equal_to< mp_count_if<L, P>, mp_size<L> >;
|
||||||
|
|
||||||
// mp_none_of<L, P>
|
// mp_none_of<L, P>
|
||||||
|
template<class L, template<class...> class P> using mp_none_of = mp_not< mp_count_if<L, P> >;
|
||||||
|
|
||||||
// mp_any_of<L, P>
|
// mp_any_of<L, P>
|
||||||
|
template<class L, template<class...> class P> using mp_any_of = mp_to_bool< mp_count_if<L, P> >;
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
@@ -8,11 +8,18 @@
|
|||||||
// See accompanying file LICENSE_1_0.txt or copy at
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/mp11/integral.hpp>
|
||||||
|
#include <boost/mp11/detail/mp_plus.hpp>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
// mp_plus<T...>
|
|
||||||
// mp_not<T>
|
// mp_not<T>
|
||||||
|
template<class T> using mp_not = mp_bool< !T::value >;
|
||||||
|
|
||||||
|
// mp_equal_to<T1, T2>
|
||||||
|
template<class T1, class T2> using mp_equal_to = mp_bool< T1::value == T2::value >;
|
||||||
|
|
||||||
// mp_all<T...>
|
// mp_all<T...>
|
||||||
// mp_and<T...>
|
// mp_and<T...>
|
||||||
// mp_any<T...>
|
// mp_any<T...>
|
||||||
|
@@ -55,6 +55,9 @@ run mp_reverse.cpp : : : $(REQ) ;
|
|||||||
run mp_fold.cpp : : : $(REQ) ;
|
run mp_fold.cpp : : : $(REQ) ;
|
||||||
run mp_reverse_fold.cpp : : : $(REQ) ;
|
run mp_reverse_fold.cpp : : : $(REQ) ;
|
||||||
run mp_unique.cpp : : : $(REQ) ;
|
run mp_unique.cpp : : : $(REQ) ;
|
||||||
|
run mp_all_of.cpp : : : $(REQ) ;
|
||||||
|
run mp_any_of.cpp : : : $(REQ) ;
|
||||||
|
run mp_none_of.cpp : : : $(REQ) ;
|
||||||
|
|
||||||
# integral
|
# integral
|
||||||
run integral.cpp : : : $(REQ) ;
|
run integral.cpp : : : $(REQ) ;
|
||||||
|
57
test/mp_all_of.cpp
Normal file
57
test/mp_all_of.cpp
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
|
||||||
|
// Copyright 2015, 2016 Peter Dimov.
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
//
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
|
||||||
|
#include <boost/mp11/algorithm.hpp>
|
||||||
|
#include <boost/mp11/list.hpp>
|
||||||
|
#include <boost/mp11/integral.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
struct X1 {};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using boost::mp_list;
|
||||||
|
using boost::mp_all_of;
|
||||||
|
using boost::mp_true;
|
||||||
|
using boost::mp_false;
|
||||||
|
|
||||||
|
{
|
||||||
|
using L1 = mp_list<>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_all_of<L1, std::is_const>, mp_true>));
|
||||||
|
|
||||||
|
using L2 = mp_list<X1 const, X1 const, X1 const volatile, X1 const, X1 const volatile>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_all_of<L2, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_all_of<L2, std::is_const>, mp_true>));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
using L1 = std::tuple<>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_all_of<L1, std::is_const>, mp_true>));
|
||||||
|
|
||||||
|
using L2 = std::tuple<X1 const, X1 const, X1 const volatile, X1 const, X1 const volatile>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_all_of<L2, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_all_of<L2, std::is_const>, mp_true>));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
using L2 = std::pair<X1 const, X1 const volatile>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_all_of<L2, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_all_of<L2, std::is_const>, mp_true>));
|
||||||
|
}
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
72
test/mp_any_of.cpp
Normal file
72
test/mp_any_of.cpp
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
|
||||||
|
// Copyright 2015, 2016 Peter Dimov.
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
//
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
|
||||||
|
#include <boost/mp11/algorithm.hpp>
|
||||||
|
#include <boost/mp11/list.hpp>
|
||||||
|
#include <boost/mp11/integral.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
struct X1 {};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using boost::mp_list;
|
||||||
|
using boost::mp_any_of;
|
||||||
|
using boost::mp_true;
|
||||||
|
using boost::mp_false;
|
||||||
|
|
||||||
|
{
|
||||||
|
using L1 = mp_list<>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L1, std::is_const>, mp_false>));
|
||||||
|
|
||||||
|
using L2 = mp_list<X1, X1 const, X1, X1, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L2, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L2, std::is_const>, mp_true>));
|
||||||
|
|
||||||
|
using L3 = mp_list<X1 const, X1 const, X1, X1 const, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L3, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L3, std::is_const>, mp_true>));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
using L1 = std::tuple<>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L1, std::is_const>, mp_false>));
|
||||||
|
|
||||||
|
using L2 = std::tuple<X1, X1 const, X1, X1, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L2, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L2, std::is_const>, mp_true>));
|
||||||
|
|
||||||
|
using L3 = std::tuple<X1 const, X1 const, X1, X1 const, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L3, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L3, std::is_const>, mp_true>));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
using L2 = std::pair<X1 const, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L2, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L2, std::is_const>, mp_true>));
|
||||||
|
|
||||||
|
using L3 = std::pair<X1 const, X1 const>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L3, std::is_volatile>, mp_false>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any_of<L3, std::is_const>, mp_true>));
|
||||||
|
}
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
72
test/mp_none_of.cpp
Normal file
72
test/mp_none_of.cpp
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
|
||||||
|
// Copyright 2015, 2016 Peter Dimov.
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
//
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
|
||||||
|
#include <boost/mp11/algorithm.hpp>
|
||||||
|
#include <boost/mp11/list.hpp>
|
||||||
|
#include <boost/mp11/integral.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
struct X1 {};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using boost::mp_list;
|
||||||
|
using boost::mp_none_of;
|
||||||
|
using boost::mp_true;
|
||||||
|
using boost::mp_false;
|
||||||
|
|
||||||
|
{
|
||||||
|
using L1 = mp_list<>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L1, std::is_const>, mp_true>));
|
||||||
|
|
||||||
|
using L2 = mp_list<X1, X1 const, X1, X1, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L2, std::is_volatile>, mp_true>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L2, std::is_const>, mp_false>));
|
||||||
|
|
||||||
|
using L3 = mp_list<X1 const, X1 const, X1, X1 const, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L3, std::is_volatile>, mp_true>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L3, std::is_const>, mp_false>));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
using L1 = std::tuple<>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L1, std::is_const>, mp_true>));
|
||||||
|
|
||||||
|
using L2 = std::tuple<X1, X1 const, X1, X1, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L2, std::is_volatile>, mp_true>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L2, std::is_const>, mp_false>));
|
||||||
|
|
||||||
|
using L3 = std::tuple<X1 const, X1 const, X1, X1 const, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L3, std::is_volatile>, mp_true>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L3, std::is_const>, mp_false>));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
using L2 = std::pair<X1 const, X1>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L2, std::is_volatile>, mp_true>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L2, std::is_const>, mp_false>));
|
||||||
|
|
||||||
|
using L3 = std::pair<X1 const, X1 const>;
|
||||||
|
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L3, std::is_volatile>, mp_true>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_none_of<L3, std::is_const>, mp_false>));
|
||||||
|
}
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
@@ -48,8 +48,8 @@ int main()
|
|||||||
#endif
|
#endif
|
||||||
BOOST_TEST_TRAIT_FALSE((mp_valid<add_pointer, void, void>));
|
BOOST_TEST_TRAIT_FALSE((mp_valid<add_pointer, void, void>));
|
||||||
|
|
||||||
#if !defined( BOOST_GCC ) || !BOOST_WORKAROUND( BOOST_GCC, < 50500 )
|
#if !defined( BOOST_GCC ) || !BOOST_WORKAROUND( BOOST_GCC, < 70000 )
|
||||||
// g++ up to at least 5.4 doesn't like add_reference for some reason or other
|
// g++ up to at least 6.2 doesn't like add_reference for some reason or other
|
||||||
BOOST_TEST_TRAIT_FALSE((mp_valid<add_reference>));
|
BOOST_TEST_TRAIT_FALSE((mp_valid<add_reference>));
|
||||||
#if !defined( BOOST_MSVC ) || !BOOST_WORKAROUND( BOOST_MSVC, <= 1800 )
|
#if !defined( BOOST_MSVC ) || !BOOST_WORKAROUND( BOOST_MSVC, <= 1800 )
|
||||||
// msvc-12.0 gives an internal error here
|
// msvc-12.0 gives an internal error here
|
||||||
|
@@ -36,6 +36,9 @@ int main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined( __clang_major__ ) && __clang_major__ == 3 && __clang_minor__ < 8
|
||||||
|
#else
|
||||||
|
|
||||||
{
|
{
|
||||||
std::tuple<std::unique_ptr<int>, std::unique_ptr<int>, std::unique_ptr<int>> tp{ std::unique_ptr<int>(new int(1)), std::unique_ptr<int>(new int(2)), std::unique_ptr<int>(new int(3)) };
|
std::tuple<std::unique_ptr<int>, std::unique_ptr<int>, std::unique_ptr<int>> tp{ std::unique_ptr<int>(new int(1)), std::unique_ptr<int>(new int(2)), std::unique_ptr<int>(new int(3)) };
|
||||||
|
|
||||||
@@ -46,6 +49,8 @@ int main()
|
|||||||
BOOST_TEST_EQ( s, 123 );
|
BOOST_TEST_EQ( s, 123 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
std::pair<int, short> tp{ 1, 2 };
|
std::pair<int, short> tp{ 1, 2 };
|
||||||
|
|
||||||
|
@@ -9,7 +9,9 @@
|
|||||||
#include <boost/tuple_for_each.hpp>
|
#include <boost/tuple_for_each.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
#if defined( BOOST_NO_CXX11_CONSTEXPR )
|
// Technically std::tuple isn't constexpr enabled in C++11, but it works with libstdc++
|
||||||
|
|
||||||
|
#if defined( BOOST_NO_CXX11_CONSTEXPR ) || ( defined( _LIBCPP_VERSION ) && __cplusplus < 201400L )
|
||||||
|
|
||||||
int main() {}
|
int main() {}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user