1 // The Art of C++ / Sequences 2 // Copyright (c) 2015 Daniel Frey 3 4 #ifndef TAOCPP_SEQUENCES_INCLUDE_MAP_HPP 5 #define TAOCPP_SEQUENCES_INCLUDE_MAP_HPP 6 7 #include <cstddef> 8 #include <utility> 9 10 #include "integer_sequence.hpp" 11 #include "select.hpp" 12 13 namespace tao 14 { 15 namespace seq 16 { 17 template< typename, typename > 18 struct map; 19 20 template< std::size_t... Ns, typename M > 21 struct map< index_sequence< Ns... >, M > 22 { 23 using type = integer_sequence< typename M::value_type, select< Ns, M >::value... >; 24 }; 25 26 template< typename S, typename M > 27 using map_t = typename map< S, M >::type; 28 } 29 } 30 31 #endif // TAOCPP_SEQUENCES_INCLUDE_MAP_HPP 32