Sha256: 79c06680f6e8f9ecb7ebe32ec0c88818d0bfaed7c67306d5ebdca99d79ae3c73
Contents?: true
Size: 1.84 KB
Versions: 34
Compression:
Stored size: 1.84 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_PRODUCE_HPP #define TAO_JSON_PRODUCE_HPP #include <ostream> #include <sstream> #include <string> #include <utility> #include "forward.hpp" #include "events/produce.hpp" #include "events/to_pretty_stream.hpp" #include "events/to_stream.hpp" #include "events/to_string.hpp" #include "events/to_value.hpp" namespace tao::json::produce { template< template< typename... > class Traits = traits, typename T > [[nodiscard]] basic_value< Traits > to_value( T&& t ) { events::to_basic_value< Traits > consumer; events::produce< Traits >( consumer, std::forward< T >( t ) ); return std::move( consumer.value ); } template< template< typename... > class Traits = traits, typename T > void to_stream( std::ostream& os, const T& t ) { events::to_stream consumer( os ); events::produce< Traits >( consumer, t ); } template< template< typename... > class Traits = traits, typename T > void to_stream( std::ostream& os, const T& t, const std::size_t indent ) { events::to_pretty_stream consumer( os, indent ); events::produce< Traits >( consumer, t ); } template< template< typename... > class Traits = traits, typename T, typename S > void to_stream( std::ostream& os, const T& t, const std::size_t indent, S&& eol ) { events::to_pretty_stream consumer( os, indent, std::forward< S >( eol ) ); events::produce< Traits >( consumer, t ); } template< template< typename... > class Traits = traits, typename... Ts > [[nodiscard]] std::string to_string( Ts&&... ts ) { std::ostringstream oss; to_stream< Traits >( oss, std::forward< Ts >( ts )... ); return oss.str(); } } // namespace tao::json::produce #endif
Version data entries
34 entries across 34 versions & 1 rubygems