File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323#include < jsoncons/utility/bigint.hpp>
2424#include < jsoncons/utility/byte_string.hpp>
2525#include < jsoncons/utility/more_type_traits.hpp>
26+ #include < jsoncons/utility/function_objects.hpp>
2627
2728namespace jsoncons {
2829
29- struct decode_half
30- {
31- double operator ()(uint16_t val) const
32- {
33- return binary::decode_half (val);
34- }
35- };
36-
3730 class typed_array_visitor
3831 {
3932 public:
Original file line number Diff line number Diff line change 2121#include < jsoncons/semantic_tag.hpp>
2222#include < jsoncons/ser_utils.hpp>
2323#include < jsoncons/utility/more_type_traits.hpp>
24+ #include < jsoncons/utility/function_objects.hpp>
2425
2526#define JSONCONS_RDONLY (X )
2627
2930namespace jsoncons {
3031namespace reflect {
3132
32- struct always_true
33- {
34- template < typename T>
35- constexpr bool operator ()(const T&) const noexcept
36- {
37- return true ;
38- }
39- };
40-
41- struct identity
42- {
43- template < typename T>
44- constexpr T&& operator ()(T&& val) const noexcept
45- {
46- return std::forward<T>(val);
47- }
48- };
49-
5033template <typename T>
5134struct json_object_name_members
5235{};
@@ -187,9 +170,6 @@ is_optional_value_set(const T&)
187170
188171} // namespace reflect
189172
190- using always_true = reflect::always_true;
191- using identity = reflect::identity;
192-
193173} // namespace jsoncons
194174
195175#if defined(_MSC_VER)
Original file line number Diff line number Diff line change 2121#include < jsoncons/sink.hpp>
2222#include < jsoncons/utility/bigint.hpp>
2323#include < jsoncons/utility/conversion.hpp>
24+ #include < jsoncons/utility/function_objects.hpp>
2425
2526namespace jsoncons {
2627
Original file line number Diff line number Diff line change 1+ // Copyright 2013-2026 Daniel Parker
2+ // Distributed under the Boost license, Version 1.0.
3+ // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4+
5+ // See https://github.com/danielaparker/jsoncons for latest version
6+
7+ #ifndef JSONCONS_UTILITY_FUNCTION_OBJECTS_HPP
8+ #define JSONCONS_UTILITY_FUNCTION_OBJECTS_HPP
9+
10+ #include < functional>
11+ #include < jsoncons/config/compiler_support.hpp>
12+
13+ namespace jsoncons {
14+
15+ struct identity
16+ {
17+ template < typename T>
18+ constexpr T&& operator ()(T&& val) const noexcept
19+ {
20+ return std::forward<T>(val);
21+ }
22+ };
23+
24+ struct always_true
25+ {
26+ template < typename T>
27+ constexpr bool operator ()(const T&) const noexcept
28+ {
29+ return true ;
30+ }
31+ };
32+
33+ struct decode_half
34+ {
35+ double operator ()(uint16_t val) const
36+ {
37+ return binary::decode_half (val);
38+ }
39+ };
40+
41+ } // namespace jsoncons
42+
43+ #endif // JSONCONS_UTILITY_FUNCTION_OBJECTS_HPP
You can’t perform that action at this time.
0 commit comments