]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/json/value_from.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / json / value_from.hpp
index 94f5522f76c2a0564a6b09fec79ef11925f503af..a14d0da2a793f88a3203d980138a6a578c5e671f 100644 (file)
@@ -18,7 +18,7 @@
 BOOST_JSON_NS_BEGIN
 
 /** Customization point tag.
-    
+
     This tag type is used by the function
     @ref value_from to select overloads
     of `tag_invoke`.
@@ -47,11 +47,11 @@ struct value_from_tag {};
     @li a library-provided generic conversion, or
 
     @li a user-provided overload of `tag_invoke`.
-    
+
     In all cases, the conversion is done by calling
     an overload of `tag_invoke` found by argument-dependent
     lookup. Its signature should be similar to:
+
     @code
     void tag_invoke( value_from_tag, value&, T );
     @endcode
@@ -65,7 +65,7 @@ struct value_from_tag {};
     Strong guarantee.
 
     @tparam T The type of the object to convert.
-    
+
     @returns `t` converted to @ref value.
 
     @param t The object to convert.
@@ -88,9 +88,51 @@ value_from(
         std::forward<T>(t), std::move(sp));
 }
 
+/** Convert an object of type `T` to @ref value.
+
+    This function attempts to convert an object
+    of type `T` to @ref value using
+
+    @li one of @ref value's constructors,
+
+    @li a library-provided generic conversion, or
+
+    @li a user-provided overload of `tag_invoke`.
+
+    In all cases, the conversion is done by calling
+    an overload of `tag_invoke` found by argument-dependent
+    lookup. Its signature should be similar to:
+
+    @code
+    void tag_invoke( value_from_tag, value&, T );
+    @endcode
+
+    @par Exception Safety
+    Strong guarantee.
+
+    @tparam T The type of the object to convert.
+
+    @param t The object to convert.
+
+    @param jv @ref value out parameter.
+
+    @see @ref value_from_tag, @ref value_to,
+    <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1895r0.pdf">
+        tag_invoke: A general pattern for supporting customisable functions</a>
+*/
+template<class T>
+void
+value_from(
+    T&& t,
+    value& jv)
+{
+    jv = detail::value_from_impl(
+        std::forward<T>(t), jv.storage());
+}
+
 /** Determine if `T` can be converted to @ref value.
 
-    If `T` can be converted to @ref value via a 
+    If `T` can be converted to @ref value via a
     call to @ref value_from, the static data member `value`
     is defined as `true`. Otherwise, `value` is
     defined as `false`.
@@ -113,4 +155,4 @@ struct has_value_from<T, detail::void_t<
 
 BOOST_JSON_NS_END
 
-#endif
\ No newline at end of file
+#endif