Sha256: e19baafb418306eedb292dd712ef87f72af30f170359074bc329c77f2a591d2d

Contents?: true

Size: 1.3 KB

Versions: 34

Compression:

Stored size: 1.3 KB

Contents

// Copyright (c) 2018-2020 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/json/

#ifndef TAO_JSON_CONTRIB_TUPLE_TRAITS_HPP
#define TAO_JSON_CONTRIB_TUPLE_TRAITS_HPP

#include <tuple>
#include <utility>

#include "../binding.hpp"

namespace tao::json
{
   namespace internal
   {
      template< std::size_t I, typename... Ts >
      struct getter
      {
         [[nodiscard]] static decltype( auto ) get( std::tuple< Ts... >& t ) noexcept
         {
            return std::get< I >( t );
         }

         [[nodiscard]] static decltype( auto ) cget( const std::tuple< Ts... >& t ) noexcept
         {
            return std::get< I >( t );
         }
      };

      template< typename Indices, typename... Ts >
      struct tuple_traits;

      template< std::size_t... Is, typename... Ts >
      struct tuple_traits< std::index_sequence< Is... >, Ts... >
      {
         template< std::size_t I >
         using helper_t = binding::element2< &getter< I, Ts... >::cget, &getter< I, Ts... >::get >;

         using type = binding::array< helper_t< Is >... >;
      };

   }  // namespace internal

   template< typename... Ts >
   struct tuple_traits
      : internal::tuple_traits< std::index_sequence_for< Ts... >, Ts... >::type
   {};

}  // namespace tao::json

#endif

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
couchbase-3.2.0-universal-darwin-20 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.2.0 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.1.1 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.1.1-universal-darwin-20 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.1.0 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.3 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.3-universal-darwin-20 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.2 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.1-universal-darwin-19 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.1 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0-universal-darwin-19 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0.beta.1 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0.alpha.5-x86_64-linux ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0.alpha.5 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp