diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2018-03-05 22:08:59 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2018-03-06 10:08:09 +0200 |
commit | b2286c6c8f9076de4143061a778fc676cc15eb84 (patch) | |
tree | 66afddb456cf35e99c0a4c4c8b32433f9811da76 /deps/tao_tuple/28626e99/include/tao/seq/type_by_index.hpp | |
parent | e8d6303d783a124aa5ba2fcf797df80a88ed546f (diff) | |
download | qtlocation-mapboxgl-b2286c6c8f9076de4143061a778fc676cc15eb84.tar.gz |
Bump Mapbox GL Native
mapbox-gl-native @ ae0e583590ce8d7a564c8d9cb7c0fcee5515125e
Follow-up, added missing headers.
Diffstat (limited to 'deps/tao_tuple/28626e99/include/tao/seq/type_by_index.hpp')
-rw-r--r-- | deps/tao_tuple/28626e99/include/tao/seq/type_by_index.hpp | 57 |
1 files changed, 57 insertions, 0 deletions
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 <cstddef> +#include <type_traits> + +#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 |