From b2286c6c8f9076de4143061a778fc676cc15eb84 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Mon, 5 Mar 2018 22:08:59 +0200 Subject: Bump Mapbox GL Native mapbox-gl-native @ ae0e583590ce8d7a564c8d9cb7c0fcee5515125e Follow-up, added missing headers. --- deps/tao_tuple/28626e99/LICENSE | 22 + .../28626e99/include/tao/seq/concatenate.hpp | 29 + deps/tao_tuple/28626e99/include/tao/seq/config.hpp | 25 + .../28626e99/include/tao/seq/exclusive_scan.hpp | 43 ++ deps/tao_tuple/28626e99/include/tao/seq/fold.hpp | 57 ++ deps/tao_tuple/28626e99/include/tao/seq/head.hpp | 30 + .../28626e99/include/tao/seq/inclusive_scan.hpp | 32 + .../28626e99/include/tao/seq/integer_sequence.hpp | 43 ++ deps/tao_tuple/28626e99/include/tao/seq/is_all.hpp | 35 + deps/tao_tuple/28626e99/include/tao/seq/is_any.hpp | 35 + .../include/tao/seq/make_integer_sequence.hpp | 84 +++ deps/tao_tuple/28626e99/include/tao/seq/map.hpp | 31 + deps/tao_tuple/28626e99/include/tao/seq/max.hpp | 33 + deps/tao_tuple/28626e99/include/tao/seq/min.hpp | 33 + deps/tao_tuple/28626e99/include/tao/seq/minus.hpp | 29 + .../28626e99/include/tao/seq/partial_sum.hpp | 42 ++ deps/tao_tuple/28626e99/include/tao/seq/plus.hpp | 29 + deps/tao_tuple/28626e99/include/tao/seq/select.hpp | 29 + deps/tao_tuple/28626e99/include/tao/seq/sum.hpp | 72 ++ deps/tao_tuple/28626e99/include/tao/seq/tail.hpp | 34 + .../28626e99/include/tao/seq/type_by_index.hpp | 57 ++ deps/tao_tuple/28626e99/include/tao/seq/values.hpp | 19 + deps/tao_tuple/28626e99/include/tao/seq/zip.hpp | 30 + .../tao_tuple/28626e99/include/tao/tuple/tuple.hpp | 817 +++++++++++++++++++++ qt_attribution.json | 13 + 25 files changed, 1703 insertions(+) create mode 100644 deps/tao_tuple/28626e99/LICENSE create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/concatenate.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/config.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/exclusive_scan.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/fold.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/head.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/inclusive_scan.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/integer_sequence.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/is_all.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/is_any.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/make_integer_sequence.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/map.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/max.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/min.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/minus.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/partial_sum.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/plus.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/select.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/sum.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/tail.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/type_by_index.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/values.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/seq/zip.hpp create mode 100644 deps/tao_tuple/28626e99/include/tao/tuple/tuple.hpp diff --git a/deps/tao_tuple/28626e99/LICENSE b/deps/tao_tuple/28626e99/LICENSE new file mode 100644 index 0000000000..c9c0ca8f4b --- /dev/null +++ b/deps/tao_tuple/28626e99/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Daniel Frey + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/deps/tao_tuple/28626e99/include/tao/seq/concatenate.hpp b/deps/tao_tuple/28626e99/include/tao/seq/concatenate.hpp new file mode 100644 index 0000000000..fd74924e1e --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/concatenate.hpp @@ -0,0 +1,29 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_CONCATENATE_HPP +#define TAOCPP_SEQUENCES_INCLUDE_CONCATENATE_HPP + +#include + +#include "integer_sequence.hpp" + +namespace tao +{ + namespace seq + { + template< typename, typename > + struct concatenate; + + template< typename TA, TA... As, typename TB, TB... Bs > + struct concatenate< integer_sequence< TA, As... >, integer_sequence< TB, Bs... > > + { + using type = integer_sequence< typename std::common_type< TA, TB >::type, As..., Bs... >; + }; + + template< typename A, typename B > + using concatenate_t = typename concatenate< A, B >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_CONCATENATE_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/config.hpp b/deps/tao_tuple/28626e99/include/tao/seq/config.hpp new file mode 100644 index 0000000000..29958766c3 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/config.hpp @@ -0,0 +1,25 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_CONFIG_HPP +#define TAOCPP_SEQUENCES_INCLUDE_CONFIG_HPP + +#if __cplusplus >= 201402L +# define TAOCPP_USE_STD_INTEGER_SEQUENCE +#endif + +#if (__cplusplus >= 201402L) && defined(_LIBCPP_VERSION) +# define TAOCPP_USE_STD_MAKE_INTEGER_SEQUENCE +#endif + +#if defined(__cpp_fold_expressions) +# define TAOCPP_FOLD_EXPRESSIONS +#elif __cplusplus > 201402L +# if defined(__apple_build_version__) && (__clang_major__ >= 7) +# define TAOCPP_FOLD_EXPRESSIONS +# elif defined(__clang__) && ((__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ >= 6))) +# define TAOCPP_FOLD_EXPRESSIONS +# endif +#endif + +#endif // TAOCPP_SEQUENCES_INCLUDE_CONFIG_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/exclusive_scan.hpp b/deps/tao_tuple/28626e99/include/tao/seq/exclusive_scan.hpp new file mode 100644 index 0000000000..e8a7c28f0f --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/exclusive_scan.hpp @@ -0,0 +1,43 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_EXCLUSIVE_SCAN_HPP +#define TAOCPP_SEQUENCES_INCLUDE_EXCLUSIVE_SCAN_HPP + +#include + +#include "make_integer_sequence.hpp" +#include "partial_sum.hpp" + +namespace tao +{ + namespace seq + { + namespace impl + { + template< typename S, typename = make_index_sequence< S::size() > > + struct exclusive_scan; + + template< typename S, std::size_t... Is > + struct exclusive_scan< S, index_sequence< Is... > > + { + using type = integer_sequence< typename S::value_type, partial_sum< Is, S >::value... >; + }; + } + + template< typename T, T... Ns > + struct exclusive_scan + : impl::exclusive_scan< integer_sequence< T, Ns... > > + {}; + + template< typename T, T... Ns > + struct exclusive_scan< integer_sequence< T, Ns... > > + : impl::exclusive_scan< integer_sequence< T, Ns... > > + {}; + + template< typename T, T... Ns > + using exclusive_scan_t = typename exclusive_scan< T, Ns... >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_EXCLUSIVE_SCAN_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/fold.hpp b/deps/tao_tuple/28626e99/include/tao/seq/fold.hpp new file mode 100644 index 0000000000..fa05c6fce7 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/fold.hpp @@ -0,0 +1,57 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_FOLD_HPP +#define TAOCPP_SEQUENCES_INCLUDE_FOLD_HPP + +#include + +#include "values.hpp" +#include "integer_sequence.hpp" +#include "make_integer_sequence.hpp" + +namespace tao +{ + namespace seq + { + namespace impl + { + template< template< typename U, U, U > class, typename, bool, typename T, T... > + struct folder; + + template< template< typename U, U, U > class OP, std::size_t... Is, typename T, T... Ns > + struct folder< OP, index_sequence< Is... >, false, T, Ns... > + { + using values = seq::values< T, Ns... >; + using type = integer_sequence< T, OP< T, values::data[ 2 * Is ], values::data[ 2 * Is + 1 ] >::value... >; + }; + + template< template< typename U, U, U > class OP, std::size_t... Is, typename T, T N, T... Ns > + struct folder< OP, index_sequence< Is... >, true, T, N, Ns... > + { + using values = seq::values< T, Ns... >; + using type = integer_sequence< T, N, OP< T, values::data[ 2 * Is ], values::data[ 2 * Is + 1 ] >::value... >; + }; + } + + template< template< typename U, U, U > class, typename T, T... > + struct fold; + + template< template< typename U, U, U > class OP, typename T, T N > + struct fold< OP, T, N > + : std::integral_constant< T, N > + {}; + + template< template< typename U, U, U > class OP, typename T, T... Ns > + struct fold + : fold< OP, typename impl::folder< OP, make_index_sequence< sizeof...( Ns ) / 2 >, sizeof...( Ns ) % 2 == 1, T, Ns... >::type > + {}; + + template< template< typename U, U, U > class OP, typename T, T... Ns > + struct fold< OP, integer_sequence< T, Ns... > > + : fold< OP, T, Ns... > + {}; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_FOLD_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/head.hpp b/deps/tao_tuple/28626e99/include/tao/seq/head.hpp new file mode 100644 index 0000000000..fcfecf0744 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/head.hpp @@ -0,0 +1,30 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_HEAD_HPP +#define TAOCPP_SEQUENCES_INCLUDE_HEAD_HPP + +#include + +#include "integer_sequence.hpp" + +namespace tao +{ + namespace seq + { + template< typename T, T... Ns > + struct head; + + template< typename T, T N, T... Ns > + struct head< T, N, Ns... > + : std::integral_constant< T, N > + {}; + + template< typename T, T... Ns > + struct head< integer_sequence< T, Ns... > > + : head< T, Ns... > + {}; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_HEAD_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/inclusive_scan.hpp b/deps/tao_tuple/28626e99/include/tao/seq/inclusive_scan.hpp new file mode 100644 index 0000000000..dc4bf72886 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/inclusive_scan.hpp @@ -0,0 +1,32 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_INCLUSIVE_SCAN_HPP +#define TAOCPP_SEQUENCES_INCLUDE_INCLUSIVE_SCAN_HPP + +#include + +#include "plus.hpp" +#include "exclusive_scan.hpp" +#include "integer_sequence.hpp" + +namespace tao +{ + namespace seq + { + template< typename T, T... Ns > + struct inclusive_scan + : plus< exclusive_scan_t< T, Ns... >, integer_sequence< T, Ns... > > + {}; + + template< typename T, T... Ns > + struct inclusive_scan< integer_sequence< T, Ns... > > + : plus< exclusive_scan_t< integer_sequence< T, Ns... > >, integer_sequence< T, Ns... > > + {}; + + template< typename T, T... Ns > + using inclusive_scan_t = typename inclusive_scan< T, Ns... >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_INCLUSIVE_SCAN_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/integer_sequence.hpp b/deps/tao_tuple/28626e99/include/tao/seq/integer_sequence.hpp new file mode 100644 index 0000000000..9f5cf64eda --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/integer_sequence.hpp @@ -0,0 +1,43 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_INTEGER_SEQUENCE_HPP +#define TAOCPP_SEQUENCES_INCLUDE_INTEGER_SEQUENCE_HPP + +#include +#include + +#include "config.hpp" + +namespace tao +{ + namespace seq + { + +#ifdef TAOCPP_USE_STD_INTEGER_SEQUENCE + + using std::integer_sequence; + using std::index_sequence; + +#else + + template< typename T, T... Ns > + struct integer_sequence + { + using value_type = T; + + static constexpr std::size_t size() noexcept + { + return sizeof...( Ns ); + } + }; + + template< std::size_t... Ns > + using index_sequence = integer_sequence< std::size_t, Ns... >; + +#endif + + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_INTEGER_SEQUENCE_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/is_all.hpp b/deps/tao_tuple/28626e99/include/tao/seq/is_all.hpp new file mode 100644 index 0000000000..5707058755 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/is_all.hpp @@ -0,0 +1,35 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_IS_ALL_HPP +#define TAOCPP_SEQUENCES_INCLUDE_IS_ALL_HPP + +#include "config.hpp" + +#ifndef TAOCPP_FOLD_EXPRESSIONS +#include "integer_sequence.hpp" +#endif + +#include + +namespace tao +{ + namespace seq + { + +#ifdef TAOCPP_FOLD_EXPRESSIONS + + template< bool... Bs > + using is_all = std::integral_constant< bool, ( Bs && ... ) >; + +#else + + template< bool... Bs > + using is_all = std::integral_constant< bool, std::is_same< integer_sequence< bool, true, Bs... >, integer_sequence< bool, Bs..., true > >::value >; + +#endif + + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_IS_ALL_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/is_any.hpp b/deps/tao_tuple/28626e99/include/tao/seq/is_any.hpp new file mode 100644 index 0000000000..36c39f66aa --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/is_any.hpp @@ -0,0 +1,35 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_IS_ANY_HPP +#define TAOCPP_SEQUENCES_INCLUDE_IS_ANY_HPP + +#include "config.hpp" + +#ifndef TAOCPP_FOLD_EXPRESSIONS +#include "is_all.hpp" +#endif + +#include + +namespace tao +{ + namespace seq + { + +#ifdef TAOCPP_FOLD_EXPRESSIONS + + template< bool... Bs > + using is_any = std::integral_constant< bool, ( Bs || ... ) >; + +#else + + template< bool... Bs > + using is_any = std::integral_constant< bool, !is_all< !Bs... >::value >; + +#endif + + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_IS_ANY_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/make_integer_sequence.hpp b/deps/tao_tuple/28626e99/include/tao/seq/make_integer_sequence.hpp new file mode 100644 index 0000000000..23a4e97180 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/make_integer_sequence.hpp @@ -0,0 +1,84 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_MAKE_INTEGER_SEQUENCE_HPP +#define TAOCPP_SEQUENCES_INCLUDE_MAKE_INTEGER_SEQUENCE_HPP + +#include +#include +#include + +#include "config.hpp" +#include "integer_sequence.hpp" + +namespace tao +{ + namespace seq + { + +#ifdef TAOCPP_USE_STD_MAKE_INTEGER_SEQUENCE + + using std::make_integer_sequence; + using std::make_index_sequence; + using std::index_sequence_for; + +#else + + // idea from http://stackoverflow.com/a/13073076 + + namespace impl + { + template< typename, std::size_t, bool > + struct double_up; + + template< typename T, T... Ns, std::size_t N > + struct double_up< integer_sequence< T, Ns... >, N, false > + { + using type = integer_sequence< T, Ns..., ( N + Ns )... >; + }; + + template< typename T, T... Ns, std::size_t N > + struct double_up< integer_sequence< T, Ns... >, N, true > + { + using type = integer_sequence< T, Ns..., ( N + Ns )..., 2 * N >; + }; + + template< typename T, T N, typename = void > + struct generate; + + template< typename T, T N > + using generate_t = typename generate< T, N >::type; + + template< typename T, T N, typename > + struct generate + : double_up< generate_t< T, N / 2 >, N / 2, N % 2 == 1 > + {}; + + template< typename T, T N > + struct generate< T, N, typename std::enable_if< ( N == 0 ) >::type > + { + using type = integer_sequence< T >; + }; + + template< typename T, T N > + struct generate< T, N, typename std::enable_if< ( N == 1 ) >::type > + { + using type = integer_sequence< T, 0 >; + }; + } + + template< typename T, T N > + using make_integer_sequence = impl::generate_t< T, N >; + + template< std::size_t N > + using make_index_sequence = make_integer_sequence< std::size_t, N >; + + template< typename... Ts > + using index_sequence_for = make_index_sequence< sizeof...( Ts ) >; + +#endif + + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_MAKE_INTEGER_SEQUENCE_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/map.hpp b/deps/tao_tuple/28626e99/include/tao/seq/map.hpp new file mode 100644 index 0000000000..e2ff85ebb8 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/map.hpp @@ -0,0 +1,31 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_MAP_HPP +#define TAOCPP_SEQUENCES_INCLUDE_MAP_HPP + +#include +#include + +#include "integer_sequence.hpp" +#include "select.hpp" + +namespace tao +{ + namespace seq + { + template< typename, typename > + struct map; + + template< std::size_t... Ns, typename M > + struct map< index_sequence< Ns... >, M > + { + using type = integer_sequence< typename M::value_type, select< Ns, M >::value... >; + }; + + template< typename S, typename M > + using map_t = typename map< S, M >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_MAP_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/max.hpp b/deps/tao_tuple/28626e99/include/tao/seq/max.hpp new file mode 100644 index 0000000000..b3f5be7976 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/max.hpp @@ -0,0 +1,33 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_MAX_HPP +#define TAOCPP_SEQUENCES_INCLUDE_MAX_HPP + +#include "fold.hpp" + +#include + +namespace tao +{ + namespace seq + { + namespace impl + { + template< typename T, T A, T B > + using max = std::integral_constant< T, ( ( A > B ) ? A : B ) >; + } + + template< typename T, T... Ns > + struct max + : fold< impl::max, T, Ns... > + {}; + + template< typename T, T... Ns > + struct max< integer_sequence< T, Ns... > > + : max< T, Ns... > + {}; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_MAX_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/min.hpp b/deps/tao_tuple/28626e99/include/tao/seq/min.hpp new file mode 100644 index 0000000000..42bc6e1610 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/min.hpp @@ -0,0 +1,33 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_MIN_HPP +#define TAOCPP_SEQUENCES_INCLUDE_MIN_HPP + +#include "fold.hpp" + +#include + +namespace tao +{ + namespace seq + { + namespace impl + { + template< typename T, T A, T B > + using min = std::integral_constant< T, ( ( A < B ) ? A : B ) >; + } + + template< typename T, T... Ns > + struct min + : fold< impl::min, T, Ns... > + {}; + + template< typename T, T... Ns > + struct min< integer_sequence< T, Ns... > > + : min< T, Ns... > + {}; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_MIN_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/minus.hpp b/deps/tao_tuple/28626e99/include/tao/seq/minus.hpp new file mode 100644 index 0000000000..087443b58f --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/minus.hpp @@ -0,0 +1,29 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_MINUS_HPP +#define TAOCPP_SEQUENCES_INCLUDE_MINUS_HPP + +#include + +#include "zip.hpp" + +namespace tao +{ + namespace seq + { + namespace impl + { + template< typename T, T A, T B > + using minus = std::integral_constant< T, A - B >; + } + + template< typename A, typename B > + using minus = zip< impl::minus, A, B >; + + template< typename A, typename B > + using minus_t = typename minus< A, B >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_MINUS_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/partial_sum.hpp b/deps/tao_tuple/28626e99/include/tao/seq/partial_sum.hpp new file mode 100644 index 0000000000..b66a02d5f0 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/partial_sum.hpp @@ -0,0 +1,42 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_PARTIAL_SUM_HPP +#define TAOCPP_SEQUENCES_INCLUDE_PARTIAL_SUM_HPP + +#include +#include + +#include "make_integer_sequence.hpp" +#include "sum.hpp" + +namespace tao +{ + namespace seq + { + namespace impl + { + template< std::size_t, typename S, typename = make_index_sequence< S::size() > > + struct partial_sum; + + template< std::size_t I, typename T, T... Ns, std::size_t... Is > + struct partial_sum< I, integer_sequence< T, Ns... >, index_sequence< Is... > > + : seq::sum< T, ( ( Is < I ) ? Ns : 0 )... > + { + static_assert( I <= sizeof...( Is ), "tao::seq::partial_sum: I is out of range" ); + }; + } + + template< std::size_t I, typename T, T... Ns > + struct partial_sum + : impl::partial_sum< I, integer_sequence< T, Ns... > > + {}; + + template< std::size_t I, typename T, T... Ns > + struct partial_sum< I, integer_sequence< T, Ns... > > + : impl::partial_sum< I, integer_sequence< T, Ns... > > + {}; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_PARTIAL_SUM_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/plus.hpp b/deps/tao_tuple/28626e99/include/tao/seq/plus.hpp new file mode 100644 index 0000000000..18ac4c435e --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/plus.hpp @@ -0,0 +1,29 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_PLUS_HPP +#define TAOCPP_SEQUENCES_INCLUDE_PLUS_HPP + +#include + +#include "zip.hpp" + +namespace tao +{ + namespace seq + { + namespace impl + { + template< typename T, T A, T B > + using plus = std::integral_constant< T, A + B >; + } + + template< typename A, typename B > + using plus = zip< impl::plus, A, B >; + + template< typename A, typename B > + using plus_t = typename plus< A, B >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_PLUS_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/select.hpp b/deps/tao_tuple/28626e99/include/tao/seq/select.hpp new file mode 100644 index 0000000000..c84c2e2179 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/select.hpp @@ -0,0 +1,29 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_SELECT_HPP +#define TAOCPP_SEQUENCES_INCLUDE_SELECT_HPP + +#include +#include + +#include "integer_sequence.hpp" +#include "values.hpp" + +namespace tao +{ + namespace seq + { + template< std::size_t I, typename T, T... Ns > + struct select + : std::integral_constant< T, values< T, Ns... >::data[ I ] > + {}; + + template< std::size_t I, typename T, T... Ns > + struct select< I, integer_sequence< T, Ns... > > + : select< I, T, Ns... > + {}; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_SELECT_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/sum.hpp b/deps/tao_tuple/28626e99/include/tao/seq/sum.hpp new file mode 100644 index 0000000000..67ac671582 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/sum.hpp @@ -0,0 +1,72 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015-2016 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_SUM_HPP +#define TAOCPP_SEQUENCES_INCLUDE_SUM_HPP + +#include +#include + +#include "integer_sequence.hpp" +#include "config.hpp" + +#ifndef TAOCPP_FOLD_EXPRESSIONS +#include +#include "make_integer_sequence.hpp" +#endif + +namespace tao +{ + namespace seq + { + +#ifdef TAOCPP_FOLD_EXPRESSIONS + + template< typename T, T... Ns > + struct sum + : std::integral_constant< T, ( Ns + ... + T( 0 ) ) > + {}; + +#else + + namespace impl + { + template< std::size_t, std::size_t N > + struct chars + { + char dummy[ N + 1 ]; + }; + + template< typename, std::size_t... > + struct collector; + + template< std::size_t... Is, std::size_t... Ns > + struct collector< index_sequence< Is... >, Ns... > + : chars< Is, Ns >... + {}; + + template< std::size_t N, typename T, T... Ns > + struct sum + { + using type = std::integral_constant< + T, + T( sizeof( collector< make_index_sequence< N >, ( ( Ns > 0 ) ? Ns : 0 )... > ) - N ) - + T( sizeof( collector< make_index_sequence< N >, ( ( Ns < 0 ) ? -Ns : 0 )... > ) - N ) >; + }; + } + + template< typename T, T... Ns > + struct sum + : impl::sum< sizeof...( Ns ) + 1, T, Ns..., 0 >::type + {}; + +#endif + + template< typename T, T... Ns > + struct sum< integer_sequence< T, Ns... > > + : sum< T, Ns... > + {}; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_SUM_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/tail.hpp b/deps/tao_tuple/28626e99/include/tao/seq/tail.hpp new file mode 100644 index 0000000000..da0caa6f1a --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/tail.hpp @@ -0,0 +1,34 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_TAIL_HPP +#define TAOCPP_SEQUENCES_INCLUDE_TAIL_HPP + +#include + +#include "integer_sequence.hpp" + +namespace tao +{ + namespace seq + { + template< typename T, T... Ns > + struct tail; + + template< typename T, T N, T... Ns > + struct tail< T, N, Ns... > + { + using type = integer_sequence< T, Ns... >; + }; + + template< typename T, T... Ns > + struct tail< integer_sequence< T, Ns... > > + : tail< T, Ns... > + {}; + + template< typename T, T... Ns > + using tail_t = typename tail< T, Ns... >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_TAIL_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/type_by_index.hpp b/deps/tao_tuple/28626e99/include/tao/seq/type_by_index.hpp new file mode 100644 index 0000000000..572c973c4e --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/type_by_index.hpp @@ -0,0 +1,57 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_TYPE_BY_INDEX_HPP +#define TAOCPP_SEQUENCES_INCLUDE_TYPE_BY_INDEX_HPP + +#include +#include + +#include "make_integer_sequence.hpp" + +namespace tao +{ + namespace seq + { + // based on http://stackoverflow.com/questions/18942322 + + namespace impl + { + template< std::size_t > + struct any + { + any( ... ); + }; + + template< typename > + struct wrapper; + + template< typename > + struct unwrap; + + template< typename T > + struct unwrap< wrapper< T > > + { + using type = T; + }; + + template< typename > + struct get_nth; + + template< std::size_t... Is > + struct get_nth< index_sequence< Is... > > + { + template< typename T > + static T deduce( any< Is & 0 >..., T*, ... ); + }; + } + + template< std::size_t I, typename... Ts > + using type_by_index = impl::unwrap< decltype( impl::get_nth< make_index_sequence< I > >::deduce( std::declval< impl::wrapper< Ts >* >()... ) ) >; + + template< std::size_t I, typename... Ts > + using type_by_index_t = typename type_by_index< I, Ts... >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_TYPE_BY_INDEX_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/values.hpp b/deps/tao_tuple/28626e99/include/tao/seq/values.hpp new file mode 100644 index 0000000000..d7e3b5d8a1 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/values.hpp @@ -0,0 +1,19 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_VALUES_HPP +#define TAOCPP_SEQUENCES_INCLUDE_VALUES_HPP + +namespace tao +{ + namespace seq + { + template< typename T, T... Ns > + struct values + { + static constexpr T data[] = { Ns... }; + }; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_VALUES_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/seq/zip.hpp b/deps/tao_tuple/28626e99/include/tao/seq/zip.hpp new file mode 100644 index 0000000000..42683b408f --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/seq/zip.hpp @@ -0,0 +1,30 @@ +// The Art of C++ / Sequences +// Copyright (c) 2015 Daniel Frey + +#ifndef TAOCPP_SEQUENCES_INCLUDE_ZIP_HPP +#define TAOCPP_SEQUENCES_INCLUDE_ZIP_HPP + +#include + +#include "integer_sequence.hpp" + +namespace tao +{ + namespace seq + { + template< template< typename U, U, U > class, typename, typename > + struct zip; + + template< template< typename U, U, U > class OP, typename TA, TA... As, typename TB, TB... Bs > + struct zip< OP, integer_sequence< TA, As... >, integer_sequence< TB, Bs... > > + { + using CT = typename std::common_type< TA, TB >::type; + using type = integer_sequence< CT, OP< CT, As, Bs >::value... >; + }; + + template< template< typename U, U, U > class OP, typename A, typename B > + using zip_t = typename zip< OP, A, B >::type; + } +} + +#endif // TAOCPP_SEQUENCES_INCLUDE_ZIP_HPP diff --git a/deps/tao_tuple/28626e99/include/tao/tuple/tuple.hpp b/deps/tao_tuple/28626e99/include/tao/tuple/tuple.hpp new file mode 100644 index 0000000000..df48592ec8 --- /dev/null +++ b/deps/tao_tuple/28626e99/include/tao/tuple/tuple.hpp @@ -0,0 +1,817 @@ +// The Art of C++ / Tuple +// Copyright (c) 2015-2016 Daniel Frey + +#ifndef TAOCPP_INCLUDE_TUPLE_TUPLE_HPP +#define TAOCPP_INCLUDE_TUPLE_TUPLE_HPP + +#include "../seq/config.hpp" +#include "../seq/integer_sequence.hpp" +#include "../seq/is_all.hpp" +#include "../seq/type_by_index.hpp" +#include "../seq/sum.hpp" +#include "../seq/make_integer_sequence.hpp" +#include "../seq/inclusive_scan.hpp" +#include "../seq/minus.hpp" +#include "../seq/map.hpp" +#include "../seq/exclusive_scan.hpp" + +#include +#include +#include + +#if (__cplusplus >= 201402L) +#define TAOCPP_TUPLE_CONSTEXPR constexpr +#else +#define TAOCPP_TUPLE_CONSTEXPR +#endif + +namespace tao +{ + template< typename... Ts > + struct tuple; +} + +namespace std +{ + // 20.4.2.8 Tuple traits [tuple.traits] + + template< typename... Ts, typename A > + struct uses_allocator< tao::tuple< Ts... >, A > : true_type {}; +} + +namespace tao +{ + template< std::size_t I, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + const seq::type_by_index_t< I, Ts... >& get( const tuple< Ts... >& ) noexcept; + + template< std::size_t I, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + seq::type_by_index_t< I, Ts... >& get( tuple< Ts... >& ) noexcept; + + template< std::size_t I, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + seq::type_by_index_t< I, Ts... >&& get( const tuple< Ts... >&& ) noexcept; + + namespace impl + { + // TODO: std::pair support + // TODO: allocator support + + using swallow = bool[]; + + template< typename T, typename > + struct dependent_type : T {}; + + template< bool B, typename T = void > + using enable_if_t = typename std::enable_if< B, T >::type; + + // TODO: using std::swap? + template< typename T > + using is_nothrow_swappable = std::integral_constant< bool, noexcept( swap( std::declval< T& >(), std::declval< T& >() ) ) >; + +#if __cplusplus >= 201402L + template< typename T > + using is_final = std::is_final< T >; +#else + template< typename T > + using is_final = std::integral_constant< bool, __is_final( T ) >; +#endif + + template< bool, bool > + struct uses_alloc_ctor; + + template< typename T, typename A, typename... As > + using uses_alloc_ctor_t = uses_alloc_ctor< std::uses_allocator< T, A >::value, std::is_constructible< T, std::allocator_arg_t, A, As... >::value >*; + + template< std::size_t I, typename T, bool = std::is_empty< T >::value && !is_final< T >::value > + struct tuple_value + { + T value; + + constexpr tuple_value() + noexcept( std::is_nothrow_default_constructible< T >::value ) + : value() + { + static_assert( !std::is_reference< T >::value, "attempted to default construct a reference element in a tuple" ); + } + + template< bool B, typename A > + tuple_value( uses_alloc_ctor< false, B >*, const A& ) + : value() + { + static_assert( !std::is_reference< T >::value, "attempted to default construct a reference element in a tuple" ); + } + + template< typename A > + tuple_value( uses_alloc_ctor< true, true >*, const A& a ) + : value( std::allocator_arg_t(), a ) + { + static_assert( !std::is_reference< T >::value, "attempted to default construct a reference element in a tuple" ); + } + + template< typename A > + tuple_value( uses_alloc_ctor< true, false >*, const A& a ) + : value( a ) + { + static_assert( !std::is_reference< T >::value, "attempted to default construct a reference element in a tuple" ); + } + + template< typename U, + typename = impl::enable_if_t< !std::is_same< typename std::decay< U >::type, tuple_value >::value >, + typename = impl::enable_if_t< std::is_constructible< T, U >::value > > + TAOCPP_TUPLE_CONSTEXPR + explicit tuple_value( U&& v ) + noexcept( std::is_nothrow_constructible< T, U >::value ) + : value( std::forward< U >( v ) ) + {} + + template< bool B, typename A, typename U > + tuple_value( uses_alloc_ctor< false, B >*, const A&, U&& v ) + : value( std::forward< U >( v ) ) + { + // TODO: Add check for rvalue to lvalue reference + } + + template< typename A, typename U > + tuple_value( uses_alloc_ctor< true, true >*, const A& a, U&& v ) + : value( std::allocator_arg_t(), a, std::forward< U >( v ) ) + { + // TODO: Add check for rvalue to lvalue reference + } + + template< typename A, typename U > + tuple_value( uses_alloc_ctor< true, false >*, const A& a, U&& v ) + : value( std::forward< U >( v ), a ) + { + // TODO: Add check for rvalue to lvalue reference + } + + tuple_value( const tuple_value& ) = default; + tuple_value( tuple_value&& ) = default; + + template< typename U > + tuple_value& operator=( U&& v ) + noexcept( std::is_nothrow_assignable< T&, U >::value ) + { + value = std::forward< U >( v ); + return *this; + } + + void swap( tuple_value& v ) + noexcept( is_nothrow_swappable< T >::value ) + { + using std::swap; + swap( value, v.value ); + } + + TAOCPP_TUPLE_CONSTEXPR + T& get() noexcept + { + return value; + } + + TAOCPP_TUPLE_CONSTEXPR + const T& get() const noexcept + { + return value; + } + }; + + template< std::size_t I, typename T > + struct tuple_value< I, T, true > + : private T + { + constexpr tuple_value() + noexcept( std::is_nothrow_default_constructible< T >::value ) + : T() + {} + + template< bool B, typename A > + tuple_value( uses_alloc_ctor< false, B >*, const A& ) + : T() + {} + + template< typename A > + tuple_value( uses_alloc_ctor< true, true >*, const A& a ) + : T( std::allocator_arg_t(), a ) + {} + + template< typename A > + tuple_value( uses_alloc_ctor< true, false >*, const A& a ) + : T( a ) + {} + + template< typename U, + typename = impl::enable_if_t< !std::is_same< typename std::decay< U >::type, tuple_value >::value >, + typename = impl::enable_if_t< std::is_constructible< T, U >::value > > + TAOCPP_TUPLE_CONSTEXPR + explicit tuple_value( U&& v ) + noexcept( std::is_nothrow_constructible< T, U >::value ) + : T( std::forward< U >( v ) ) + {} + + template< bool B, typename A, typename U > + tuple_value( uses_alloc_ctor< false, B >*, const A&, U&& v ) + : T( std::forward< U >( v ) ) + {} + + template< typename A, typename U > + tuple_value( uses_alloc_ctor< true, true >*, const A& a, U&& v ) + : T( std::allocator_arg_t(), a, std::forward< U >( v ) ) + {} + + template< typename A, typename U > + tuple_value( uses_alloc_ctor< true, false >*, const A& a, U&& v ) + : T( std::forward< U >( v ), a ) + {} + + tuple_value( const tuple_value& ) = default; + tuple_value( tuple_value&& ) = default; + + template< typename U > + tuple_value& operator=( U&& v ) + noexcept( std::is_nothrow_assignable< T&, U >::value ) + { + T::operator=( std::forward< U >( v ) ); + return *this; + } + + void swap( tuple_value& v ) + noexcept( is_nothrow_swappable< T >::value ) + { + using std::swap; + swap( *this, v ); + } + + TAOCPP_TUPLE_CONSTEXPR + T& get() noexcept + { + return static_cast< T& >( *this ); + } + + TAOCPP_TUPLE_CONSTEXPR + const T& get() const noexcept + { + return static_cast< const T& >( *this ); + } + }; + + template< typename, typename... > + struct tuple_base; + + template< std::size_t... Is, typename... Ts > + struct tuple_base< seq::index_sequence< Is... >, Ts... > + : tuple_value< Is, Ts >... + { + constexpr tuple_base() = default; + + template< typename... Us > + TAOCPP_TUPLE_CONSTEXPR + explicit tuple_base( Us&&... us ) + : tuple_value< Is, Ts >( std::forward< Us >( us ) )... + {} + + template< typename A, typename... Us > + TAOCPP_TUPLE_CONSTEXPR + tuple_base( std::allocator_arg_t, const A& a, Us&&... us ) + : tuple_value< Is, Ts >( uses_alloc_ctor_t< Ts, A, Us >(), a, std::forward< Us >( us ) )... + {} + + tuple_base( const tuple_base& ) = default; + tuple_base( tuple_base&& ) = default; + + tuple_base& operator=( const tuple_base& v ) + noexcept( seq::is_all< std::is_nothrow_copy_assignable< Ts >::value... >::value ) + { +#ifdef TAOCPP_FOLD_EXPRESSIONS + ( tuple_value< Is, Ts >::operator=( static_cast< tuple_value< Is, Ts >& >( v ).get() ), ... ); +#else + (void)swallow{ ( tuple_value< Is, Ts >::operator=( static_cast< tuple_value< Is, Ts >& >( v ).get() ), true )..., true }; +#endif + return *this; + } + + tuple_base& operator=( tuple_base&& v ) + noexcept( seq::is_all< std::is_nothrow_move_assignable< Ts >::value... >::value ) + { +#ifdef TAOCPP_FOLD_EXPRESSIONS + ( tuple_value< Is, Ts >::operator=( std::forward< Ts >( static_cast< tuple_value< Is, Ts >& >( v ).get() ) ), ... ); +#else + (void)swallow{ ( tuple_value< Is, Ts >::operator=( static_cast< tuple_value< Is, Ts >& >( v ) ), true )..., true }; +#endif + return *this; + } + + template< typename... Us > + tuple_base& operator=( const tuple< Us... >& v ) + noexcept( seq::is_all< std::is_nothrow_assignable< Ts&, const Us& >::value... >::value ) + { +#ifdef TAOCPP_FOLD_EXPRESSIONS + ( tuple_value< Is, Ts >::operator=( get< Is >( v ) ), ... ); +#else + (void)swallow{ ( tuple_value< Is, Ts >::operator=( get< Is >( v ) ), true )..., true }; +#endif + return *this; + } + + template< typename... Us > + tuple_base& operator=( tuple< Us... >&& v ) + noexcept( seq::is_all< std::is_nothrow_assignable< Ts&, Us&& >::value... >::value ) + { +#ifdef TAOCPP_FOLD_EXPRESSIONS + ( tuple_value< Is, Ts >::operator=( get< Is >( std::move( v ) ) ), ... ); +#else + (void)swallow{ ( tuple_value< Is, Ts >::operator=( get< Is >( std::move( v ) ) ), true )..., true }; +#endif + return *this; + } + + void swap( tuple_base& v ) + noexcept( seq::is_all< impl::is_nothrow_swappable< Ts >::value... >::value ) + { +#ifdef TAOCPP_FOLD_EXPRESSIONS + ( static_cast< tuple_value< Is, Ts >& >( *this ).swap( static_cast< tuple_value< Is, Ts >& >( v ) ), ... ); +#else + (void)swallow{ ( static_cast< tuple_value< Is, Ts >& >( *this ).swap( static_cast< tuple_value< Is, Ts >& >( v ) ), true )..., true }; +#endif + } + }; + } + + // 20.4.2 Class template tuple [tuple.tuple] + + // tuple + template< typename... Ts > + struct tuple + { + private: + using base_t = impl::tuple_base< seq::index_sequence_for< Ts... >, Ts... >; + base_t base; + + template< std::size_t I, typename... Us > + friend TAOCPP_TUPLE_CONSTEXPR + const seq::type_by_index_t< I, Us... >& get( const tuple< Us... >& ) noexcept; + + template< std::size_t I, typename... Us > + friend TAOCPP_TUPLE_CONSTEXPR + seq::type_by_index_t< I, Us... >& get( tuple< Us... >& ) noexcept; + + template< std::size_t I, typename... Us > + friend TAOCPP_TUPLE_CONSTEXPR + seq::type_by_index_t< I, Us... >&& get( tuple< Us... >&& ) noexcept; + + public: + // 20.4.2.1 Construction [tuple.cnstr] + + // TODO: Move this templated condition to base? + template< typename dummy = void, + typename = impl::enable_if_t< seq::is_all< impl::dependent_type< std::is_default_constructible< Ts >, dummy >::value... >::value > > + constexpr tuple() + noexcept( seq::is_all< std::is_nothrow_default_constructible< Ts >::value... >::value ) + : base() + {} + + template< typename dummy = void, + typename = impl::enable_if_t< seq::is_all< impl::dependent_type< std::is_copy_constructible< Ts >, dummy >::value... >::value > > + TAOCPP_TUPLE_CONSTEXPR + explicit tuple( const Ts&... ts ) + noexcept( seq::is_all< std::is_nothrow_copy_constructible< Ts >::value... >::value ) + : base( ts... ) + {} + + template< typename... Us, + typename = impl::enable_if_t< sizeof...( Us ) == sizeof...( Ts ) >, + typename = impl::enable_if_t< seq::is_all< std::is_constructible< Ts, Us&& >::value... >::value > > + TAOCPP_TUPLE_CONSTEXPR + explicit tuple( Us&&... us ) + noexcept( seq::is_all< std::is_nothrow_constructible< Ts, Us&& >::value... >::value ) + : base( std::forward< Us >( us )... ) + {} + + tuple( const tuple& ) = default; + tuple( tuple&& ) = default; + + template< typename... Us, + typename = impl::enable_if_t< sizeof...( Us ) == sizeof...( Ts ) >, + typename = impl::enable_if_t< seq::is_all< std::is_constructible< Ts, const Us& >::value... >::value > > + TAOCPP_TUPLE_CONSTEXPR + explicit tuple( const tuple< Us... >& v ) + noexcept( seq::is_all< std::is_nothrow_constructible< Ts, const Us& >::value... >::value ) + : base( v ) + {} + + template< typename... Us, + typename = impl::enable_if_t< sizeof...( Us ) == sizeof...( Ts ) >, + typename = impl::enable_if_t< seq::is_all< std::is_constructible< Ts, Us&& >::value... >::value > > + TAOCPP_TUPLE_CONSTEXPR + explicit tuple( tuple< Us... >&& v ) + noexcept( seq::is_all< std::is_nothrow_constructible< Ts, Us&& >::value... >::value ) + : base( std::move( v ) ) + {} + + template< typename A, + typename dummy = void, + typename = impl::enable_if_t< seq::is_all< impl::dependent_type< std::is_default_constructible< Ts >, dummy >::value... >::value > > + tuple( std::allocator_arg_t, const A& a ) + : base( std::allocator_arg_t(), a ) + {} + + template< typename A, + typename dummy = void, + typename = impl::enable_if_t< seq::is_all< impl::dependent_type< std::is_copy_constructible< Ts >, dummy >::value... >::value > > + tuple( std::allocator_arg_t, const A& a, const Ts&... ts ) + : base( std::allocator_arg_t(), a, ts... ) + {} + + template< typename A, + typename... Us, + typename = impl::enable_if_t< sizeof...( Us ) == sizeof...( Ts ) >, + typename = impl::enable_if_t< seq::is_all< std::is_constructible< Ts, Us&& >::value... >::value > > + tuple( std::allocator_arg_t, const A& a, Us&&... us ) + : base( std::allocator_arg_t(), a, std::forward< Us >( us )... ) + {} + + template< typename A > + tuple( std::allocator_arg_t, const A& a, const tuple& v ) + : base( std::allocator_arg_t(), a, v ) + {} + + template< typename A > + tuple( std::allocator_arg_t, const A& a, tuple&& v ) + : base( std::allocator_arg_t(), a, std::move( v ) ) + {} + + template< typename A, + typename... Us, + typename = impl::enable_if_t< sizeof...( Us ) == sizeof...( Ts ) >, + typename = impl::enable_if_t< seq::is_all< std::is_constructible< Ts, const Us& >::value... >::value > > + tuple( std::allocator_arg_t, const A& a, const tuple< Us... >& v ) + : base( std::allocator_arg_t(), a, v ) + {} + + template< typename A, + typename... Us, + typename = impl::enable_if_t< sizeof...( Us ) == sizeof...( Ts ) >, + typename = impl::enable_if_t< seq::is_all< std::is_constructible< Ts, Us&& >::value... >::value > > + tuple( std::allocator_arg_t, const A& a, tuple< Us... >&& v ) + : base( std::allocator_arg_t(), a, std::move( v ) ) + {} + + // 20.4.2.2 Assignment [tuple.assign] + + template< typename T, + typename = impl::enable_if_t< std::is_assignable< base_t&, T >::value > > + tuple& operator=( T&& v ) + noexcept( std::is_nothrow_assignable< base_t&, T >::value ) + { + base = std::forward< T >( v ); + return *this; + } + + // 20.4.2.3 swap [tuple.swap] + + void swap( tuple& v ) + noexcept( noexcept( base.swap( v.base ) ) ) + { + base.swap( v.base ); + } + }; + + template<> + struct tuple<> + { + constexpr tuple() noexcept {} + template< typename A > tuple( std::allocator_arg_t, const A& ) noexcept {} + template< typename A > tuple( std::allocator_arg_t, const A&, const tuple& ) noexcept {} + void swap( tuple& ) noexcept {} + }; + + // 20.4.2.4 Tuple creation functions [tuple.creation] + + // ignore helper + namespace impl + { + struct ignore_t + { + template< typename U > + ignore_t& operator=( U&& ) + { + return *this; + } + }; + } + + // ignore + const impl::ignore_t ignore{}; + + // make_tuple helper + namespace impl + { + template< typename T > + struct make_tuple_return + { + using type = T; + }; + + template< typename T > + struct make_tuple_return< std::reference_wrapper< T > > + { + using type = T&; + }; + + template< typename T > + using make_tuple_return_t = typename make_tuple_return< T >::type; + } + + // make_tuple + template< typename... Ts, typename R = tuple< impl::make_tuple_return_t< typename std::decay< Ts >::type >... > > + TAOCPP_TUPLE_CONSTEXPR + R make_tuple( Ts&&... ts ) + { + return R( std::forward< Ts >( ts )... ); + } + + // forward_as_tuple + template< typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + tuple< Ts&&... > forward_as_tuple( Ts&&... ts ) noexcept + { + return tuple< Ts&&... >( std::forward< Ts >( ts )... ); + } + + // tie + template< typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + tuple< Ts&... > tie( Ts&... ts ) noexcept + { + return tuple< Ts&... >( ts... ); + } + + // tuple_cat is found at the end, as it requires access to tuple_element_t and get + + // 20.4.2.5 Tuple helper classes [tuple.helper] + + // tuple_size + template< typename T > struct tuple_size; + template< typename T > struct tuple_size< const T > : tuple_size< T > {}; + template< typename T > struct tuple_size< volatile T > : tuple_size< T > {}; + template< typename T > struct tuple_size< const volatile T > : tuple_size< T > {}; + + template< typename... Ts > + struct tuple_size< tuple< Ts... > > + : std::integral_constant< std::size_t, sizeof...( Ts ) > + {}; + + // tuple_element + template< std::size_t I, typename T > struct tuple_element; + template< std::size_t I, typename T > struct tuple_element< I, const T > : tuple_element< I, T > {}; + template< std::size_t I, typename T > struct tuple_element< I, volatile T > : tuple_element< I, T > {}; + template< std::size_t I, typename T > struct tuple_element< I, const volatile T > : tuple_element< I, T > {}; + + template< std::size_t I, typename... Ts > + struct tuple_element< I, tuple< Ts... > > + : seq::type_by_index< I, Ts... > + {}; + +#if __cplusplus >= 201402L + template< std::size_t I, typename T > + using tuple_element_t = typename tuple_element< I, T >::type; +#endif + + // 20.4.2.6 Element access [tuple.elem] + + // get + template< std::size_t I, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + const seq::type_by_index_t< I, Ts... >& get( const tuple< Ts... >& v ) noexcept + { + return static_cast< const impl::tuple_value< I, seq::type_by_index_t< I, Ts... > >& >( v.base ).get(); + } + + template< std::size_t I, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + seq::type_by_index_t< I, Ts... >& get( tuple< Ts... >& v ) noexcept + { + return static_cast< impl::tuple_value< I, seq::type_by_index_t< I, Ts... > >& >( v.base ).get(); + } + + template< std::size_t I, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + seq::type_by_index_t< I, Ts... >&& get( tuple< Ts... >&& v ) noexcept + { + using type = seq::type_by_index_t< I, Ts... >; + return static_cast< type&& >( static_cast< impl::tuple_value< I, type >& >( v.base ).get() ); + } + + // get helper + namespace impl + { + template< typename T, typename... Ts > + using count_of = seq::sum< std::size_t, ( std::is_same< T, Ts >::value ? 1 : 0 )... >; + + template< typename, typename, typename... > + struct index_of_impl; + + template< std::size_t... Is, typename T, typename... Ts > + struct index_of_impl< seq::index_sequence< Is... >, T, Ts... > + : seq::sum< std::size_t, ( std::is_same< T, Ts >::value ? Is : 0 )... > + { + static_assert( count_of< T, Ts... >::value > 0, "T not found within Ts..." ); + static_assert( count_of< T, Ts... >::value < 2, "T must be unique within Ts..." ); + }; + + template< typename T, typename... Ts > + using index_of = index_of_impl< seq::index_sequence_for< Ts... >, T, Ts... >; + } + + // get + template< typename T, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + const T& get( const tuple< Ts... >& v ) noexcept + { + return get< impl::index_of< T, Ts... >::value >( v ); + } + + template< typename T, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + T& get( tuple< Ts... >& v ) noexcept + { + return get< impl::index_of< T, Ts... >::value >( v ); + } + + template< typename T, typename... Ts > + TAOCPP_TUPLE_CONSTEXPR + T&& get( tuple< Ts... >&& v ) noexcept + { + return get< impl::index_of< T, Ts... >::value >( std::move( v ) ); + } + + // 20.4.2.7 Relational operators [tuple.rel] + + // operators helper + namespace impl + { + template< typename > + struct tuple_equal; + + template< std::size_t... Is > + struct tuple_equal< seq::index_sequence< Is... > > + { + template< typename T, typename U > + TAOCPP_TUPLE_CONSTEXPR + bool operator()( const T& lhs, const U& rhs ) const + { +#ifdef TAOCPP_FOLD_EXPRESSIONS + return ( static_cast< bool >( get< Is >( lhs ) == get< Is >( rhs ) ) && ... ); +#else + bool result = true; + (void)swallow{ ( result = result && static_cast< bool >( get< Is >( lhs ) == get< Is >( rhs ) ) )..., true }; + return result; +#endif + } + }; + + template< typename > + struct tuple_less; + + template< std::size_t... Is > + struct tuple_less< seq::index_sequence< Is... > > + { + template< typename T, typename U > + TAOCPP_TUPLE_CONSTEXPR + bool operator()( const T& lhs, const U& rhs ) const + { + bool result = false; +#ifdef TAOCPP_DUMMY // TAOCPP_FOLD_EXPRESSIONS + // TODO: This fold expression does not work as expected. Why? + (void)( ( ( result = static_cast< bool >( get< Is >( lhs ) < get< Is >( rhs ) ) ) || static_cast< bool >( get< Is >( rhs ) < get< Is >( lhs ) ) ) || ... ); +#else + bool no_result_yet = false; + (void)swallow{ ( no_result_yet = no_result_yet || ( result = static_cast< bool >( get< Is >( lhs ) < get< Is >( rhs ) ) ) || static_cast< bool >( get< Is >( rhs ) < get< Is >( lhs ) ) )..., true }; + (void)no_result_yet; +#endif + return result; + } + }; + } + + // operators + template< typename... Ts, typename... Us, typename = impl::enable_if_t< sizeof...( Ts ) == sizeof...( Us ) > > + TAOCPP_TUPLE_CONSTEXPR + bool operator==( const tuple< Ts... >& lhs, const tuple< Us... >& rhs ) + { + return impl::tuple_equal< seq::index_sequence_for< Ts... > >()( lhs, rhs ); + } + + template< typename... Ts, typename... Us > + TAOCPP_TUPLE_CONSTEXPR + bool operator!=( const tuple< Ts... >& lhs, const tuple< Us... >& rhs ) + { + return !( lhs == rhs ); + } + + template< typename... Ts, typename... Us, typename = impl::enable_if_t< sizeof...( Ts ) == sizeof...( Us ) > > + TAOCPP_TUPLE_CONSTEXPR + bool operator<( const tuple< Ts... >& lhs, const tuple< Us... >& rhs ) + { + return impl::tuple_less< seq::index_sequence_for< Ts... > >()( lhs, rhs ); + } + + template< typename... Ts, typename... Us > + TAOCPP_TUPLE_CONSTEXPR + bool operator>=( const tuple< Ts... >& lhs, const tuple< Us... >& rhs ) + { + return !( lhs < rhs ); + } + + template< typename... Ts, typename... Us > + TAOCPP_TUPLE_CONSTEXPR + bool operator>( const tuple< Ts... >& lhs, const tuple< Us... >& rhs ) + { + return rhs < lhs; + } + + template< typename... Ts, typename... Us > + TAOCPP_TUPLE_CONSTEXPR + bool operator<=( const tuple< Ts... >& lhs, const tuple< Us... >& rhs ) + { + return !( rhs < lhs ); + } + + // 20.4.2.9 Tuple specialized algorithms [tuple.special] + + // swap + template< typename... Ts > + void swap( tuple< Ts... >& lhs, tuple< Ts... >& rhs ) + noexcept( noexcept( lhs.swap( rhs ) ) ) + { + lhs.swap( rhs ); + } + + // (continued:) 20.4.2.4 Tuple creation functions [tuple.creation] + + // tuple_cat helper + namespace impl + { + template< std::size_t M, std::size_t... Ns > + struct count_less_or_equal + : seq::sum< std::size_t, ( ( Ns <= M ) ? 1 : 0 )... > + {}; + + template< typename, typename > + struct expand; + + template< std::size_t... Is, std::size_t... Ns > + struct expand< seq::index_sequence< Is... >, seq::index_sequence< Ns... > > + { + using type = seq::index_sequence< count_less_or_equal< Is, Ns... >::value... >; + }; + + template< typename I, typename S > + using expand_t = typename expand< I, S >::type; + + template< typename... > + struct tuple_cat_result; + + template< std::size_t... Os, std::size_t... Is, typename... Ts > + struct tuple_cat_result< seq::index_sequence< Os... >, seq::index_sequence< Is... >, Ts... > + { + using type = tuple< typename tuple_element< Is, seq::type_by_index_t< Os, Ts... > >::type... >; + }; + + template< typename... Ts > + using tuple_cat_result_t = typename tuple_cat_result< Ts... >::type; + + template< typename... Ts > + struct tuple_cat_helper + { + using tuple_size_sequence = seq::index_sequence< tuple_size< Ts >::value... >; + using result_index_sequence = seq::make_index_sequence< seq::sum< tuple_size_sequence >::value >; + + using outer_index_sequence = expand_t< result_index_sequence, seq::inclusive_scan_t< tuple_size_sequence > >; + using inner_index_sequence = seq::minus_t< result_index_sequence, seq::map_t< outer_index_sequence, seq::exclusive_scan_t< tuple_size_sequence > > >; + + using result_type = tuple_cat_result_t< outer_index_sequence, inner_index_sequence, Ts... >; + }; + + template< typename R, std::size_t... Os, std::size_t... Is, typename T > + TAOCPP_TUPLE_CONSTEXPR + R tuple_cat( seq::index_sequence< Os... >, seq::index_sequence< Is... >, T v ) + { + return R( get< Is >( get< Os >( v ) )... ); + } + } + + // tuple_cat + template< typename... Ts, typename H = impl::tuple_cat_helper< typename std::remove_reference< Ts >::type... >, typename R = typename H::result_type > + TAOCPP_TUPLE_CONSTEXPR + R tuple_cat( Ts&&... ts ) + { + return impl::tuple_cat< R >( typename H::outer_index_sequence(), typename H::inner_index_sequence(), tao::forward_as_tuple( std::forward< Ts >( ts )... ) ); + } +} + +#undef TAOCPP_TUPLE_CONSTEXPR + +#endif // TAOCPP_INCLUDE_TUPLE_TUPLE_HPP diff --git a/qt_attribution.json b/qt_attribution.json index 4a50d4651c..7ca84ae92b 100644 --- a/qt_attribution.json +++ b/qt_attribution.json @@ -192,6 +192,19 @@ "License": "ISC License", "Copyright": "Copyright (c) 2016 Mapbox" }, + { + "Id": "mapboxgl-tao_tuple", + "Name": "tao_tuple", + "QDocModule": "qtlocation", + "QtUsage": "Used in the Mapbox GL plugin of Qt Location.", + + "Path": "deps/tao_tuple", + "Description": "The Art of C++ implementation of std::tuple and std::integer_sequence.", + "Homepage": "https://github.com/taocpp/", + "LicenseId": "MIT", + "License": "MIT License", + "Copyright": "Copyright (c) 2015-2017 Daniel Frey" + }, { "Id": "mapboxgl-unique_resource", "Name": "unique_resource", -- cgit v1.2.1