Sha256: c8084b879d54147832bb94fd20427a74e284fb9c7f988ae7b63cf37ca7f37172

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

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

#ifndef TAO_JSON_CONSUME_HPP
#define TAO_JSON_CONSUME_HPP

#include <type_traits>

#include "forward.hpp"

#include "internal/type_traits.hpp"

namespace tao::json
{
   template< typename T, template< typename... > class Traits = traits, typename Producer >
   [[nodiscard]] std::enable_if_t< internal::has_consume_one< Traits, Producer, T >, T > consume( Producer& parser )
   {
      return Traits< T >::template consume< Traits >( parser );
   }

   template< typename T, template< typename... > class Traits = traits, typename Producer >
   [[nodiscard]] std::enable_if_t< !internal::has_consume_one< Traits, Producer, T >, T > consume( Producer& parser )
   {
      T t;
      Traits< T >::template consume< Traits >( parser, t );
      return t;
   }

   template< template< typename... > class Traits = traits, typename Producer, typename T >
   std::enable_if_t< internal::has_consume_two< Traits, Producer, T >, void > consume( Producer& parser, T& t )
   {
      Traits< T >::template consume< Traits >( parser, t );
   }

   template< template< typename... > class Traits = traits, typename Producer, typename T >
   std::enable_if_t< !internal::has_consume_two< Traits, Producer, T >, void > consume( Producer& parser, T& t )
   {
      t = Traits< T >::template consume< Traits >( parser );
   }

}  // namespace tao::json

#endif

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
couchbase-3.4.5 ext/couchbase/third_party/json/include/tao/json/consume.hpp
couchbase-3.4.4 ext/couchbase/third_party/json/include/tao/json/consume.hpp
couchbase-3.4.3 ext/couchbase/third_party/json/include/tao/json/consume.hpp
couchbase-3.4.2 ext/couchbase/third_party/json/include/tao/json/consume.hpp
couchbase-3.4.1 ext/couchbase/third_party/json/include/tao/json/consume.hpp
couchbase-3.4.0 ext/couchbase/third_party/json/include/tao/json/consume.hpp
couchbase-3.3.0 ext/couchbase/third_party/json/include/tao/json/consume.hpp