Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:34:44

0001 //
0002 // Copyright (c) 2023 Dmitry Arkhipov (grisumbras@yandex.ru)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/json
0008 //
0009 
0010 #ifndef BOOST_JSON_IMPL_SERIALIZE_HPP
0011 #define BOOST_JSON_IMPL_SERIALIZE_HPP
0012 
0013 #include <boost/json/serializer.hpp>
0014 
0015 namespace boost {
0016 namespace json {
0017 namespace detail {
0018 
0019 BOOST_JSON_DECL
0020 void
0021 serialize_impl(std::string& s, serializer& sr);
0022 
0023 } // namespace detail
0024 
0025 template<class T>
0026 std::string
0027 serialize(T const& t, serialize_options const& opts)
0028 {
0029     unsigned char buf[256];
0030     serializer sr(
0031         storage_ptr(),
0032         buf,
0033         sizeof(buf),
0034         opts);
0035     std::string s;
0036     sr.reset(&t);
0037     detail::serialize_impl(s, sr);
0038     return s;
0039 }
0040 
0041 } // namespace json
0042 } // namespace boost
0043 
0044 #endif // BOOST_JSON_IMPL_SERIALIZE_HPP