Remove trailing whitespace

This commit is contained in:
Dmitry Arkhipov 2021-06-26 16:17:57 +03:00
parent 138244b363
commit 445efad9a9
46 changed files with 247 additions and 247 deletions

View File

@ -42,17 +42,17 @@ be present.
Elements shall appear in the following order:
/** {Brief}
{Description}
[@par Complexity
{Complexity}]
@par Preconditions
{Preconditions}
@ -119,15 +119,15 @@ going into much depth. For functions with no side effects, preconditions,
thrown exceptions and parameters, this should state what the function returns;
further description can be done as a remark. For functions with side effects, it
should be a synopsis of what the function does. For class types, it should describe
what the class does, and for type aliases it should describe what the type represents.
what the class does, and for type aliases it should describe what the type represents.
Length requirement: Length should be no more than 200 characters.
Length requirement: Length should be no more than 200 characters.
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
Description
Appearance: This should be included if the brief and remarks are not sufficient
to describe what the entity does. This shall not be present for type aliases,
to describe what the entity does. This shall not be present for type aliases,
or function that have no side effects.
Description: Sufficiently describes the function including all its effects upon its
@ -202,7 +202,7 @@ Exception Safety
Appearance: Shall be present for functions that are potentially throwing
Description: Specifies the exception safety guarantee of the function. Shall be
one of: "Strong guarantee", "Basic guarantee", or "No guarantee".
one of: "Strong guarantee", "Basic guarantee", or "No guarantee".
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
@ -230,7 +230,7 @@ Exceptions
Appearance: Shall be present for functions that are potentially throwing
Description: Specifies which exceptions can potentially be directly
thrown by that function and under which conditions they are thrown.
thrown by that function and under which conditions they are thrown.
---------------------------------------------------------------------------------------
------------- OPTIONAL -------------

View File

@ -13,7 +13,7 @@
[section string]
Modifiable sequences of characters are represented using objects of type __string__.
The interface and functionality of __string__ is
The interface and functionality of __string__ is
the same as `std::basic_string` except that:
* __string__ is not a class template,
@ -29,10 +29,10 @@ with a __string_view__ based interface,
With augmented interface, operations requiring an input string
are implemented as a single overload with a parameter of type
__string_view__, and can accept most string-like objects.
__string_view__, and can accept most string-like objects.
Objects such as null terminated character pointers, `std::string`,
`json::string`, subranges of strings, and objects
convertible to __string_view__ can all be passed to these functions.
convertible to __string_view__ can all be passed to these functions.
[snippet_strings_4]

View File

@ -14,14 +14,14 @@
JSON numbers are represented using `std::int64_t`, `std::uint64_t`, and `double`.
When a __value__ is constructed from an unsigned integer, its __kind__
will be `kind::uint64`. Likewise, a __value__ constructed from
a signed integer will have `kind::int64`, or `kind::double_` if
a signed integer will have `kind::int64`, or `kind::double_` if
constructed from a floating-point type:
[doc_using_numbers_1]
When accessing a number contained within a __value__, the function
used must match the value's __kind__ exactly; no conversions will be performed.
For example if `as_double` is called on a __value__ that contains a `std::uint64_t`,
used must match the value's __kind__ exactly; no conversions will be performed.
For example if `as_double` is called on a __value__ that contains a `std::uint64_t`,
an exception is thrown. Similarly, the function `if_double` will return `nullptr`
and calling `get_double` will result in undefined behavior:
@ -65,7 +65,7 @@ More formally, if the number:
* is negative and its value is less than `INT64_MIN`, or
* is positive and its value is greater than `UINT64_MAX`,
then its type is `double`.
then its type is `double`.
Otherwise, if the number is positive and its value is
greater than `INT64_MAX`, then its type is `std::uint64_t`.
All other numbers are parsed as `std::int64_t`.

View File

@ -33,7 +33,7 @@ it represents an __array__ or an __object__:
In such cases, if every element consists
of a string followed by a single value, then the enclosing
initializer list is interpreted as an __object__.
initializer list is interpreted as an __object__.
Otherwise, it is interpreted as an __array__.
[snippet_init_list_5]

View File

@ -149,7 +149,7 @@ allow some non-standard JSON extensions to be recognized:
[heading Streaming Parser]
The __stream_parser__ implements a
The __stream_parser__ implements a
[@https://en.wikipedia.org/wiki/Online_algorithm ['streaming algorithm]];
it allows incremental processing of large JSON inputs using one or more
contiguous character buffers. The entire input JSON does not need to be

View File

@ -51,11 +51,11 @@ The __serialize__ function converts a __value__ into a __std_string__:
[doc_serializing_2]
In situations where serializing a __value__
In situations where serializing a __value__
in its entirety is inefficient or even impossible,
__serializer__ can be used to incrementally serialize
a __value__ incrementally. This may be done for a variety
of reasons, such as to avoid buffering the entire output,
of reasons, such as to avoid buffering the entire output,
or to ensure that a fixed amount of work is performed
in each cycle. Instances of __serializer__ maintain an
output state using internal dynamically allocated structures,

View File

@ -17,7 +17,7 @@
"Isn't simdjson faster?"
][
These libraries are not comparable.
The output of the simdjson parser is a read-only structure.
The output of the simdjson parser is a read-only structure.
In other words, it can't be changed, and the only way to create one is
by parsing a JSON string. On the other hand, Boost.JSON allows you to
modify the container holding the parsed JSON, or even build a JSON

View File

@ -13,7 +13,7 @@ This section compares the performance of Boost.JSON with two widely
used libraries with similar functionality:
RapidJSON
which is known for its performance, and
JSON for Modern C++
JSON for Modern C++
which is known for feature-richness.
The bench program measures the throughput of parsing and
serialization for the a set of JSON representing typical
@ -192,7 +192,7 @@ The input files, available in the bench/data directory, are laid out thusly:
]
Hardware used for testing: [*Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz],
Windows 10, 32GB RAM.
Windows 10, 32GB RAM.
Compilers and optimization flags: gcc 8.1 (-O3), clang 12.0 (-O3), and msvc 19.26 (/O2).

View File

@ -79,7 +79,7 @@ vocabulary type.
* Value Type: [@https://github.com/Tencent/rapidjson/blob/bb5f966b9939d6cdfbac3462a0410e185099b3af/include/rapidjson/document.h#L608 `rapidjson::GenericValue`]
```
template <typename Encoding, typename Allocator = MemoryPoolAllocator<> >
template <typename Encoding, typename Allocator = MemoryPoolAllocator<> >
class GenericValue;
template <bool Const, typename ValueT>

View File

@ -89,7 +89,7 @@ pretty_print( std::ostream& os, json::value const& jv, std::string* indent = nul
if(++it == arr.end())
break;
os << ",\n";
}
}
}
os << "\n";
indent->resize(indent->size() - 4);

View File

@ -57,7 +57,7 @@ public:
~null_parser()
{
}
std::size_t
write(
char const* data,

View File

@ -363,7 +363,7 @@ public:
This is more efficient than move construction, when
it is known that the moved-from object will be
immediately destroyed afterwards.
@par Complexity
Constant.
@ -396,7 +396,7 @@ public:
After construction, the moved-from array behaves
as if newly constructed with its current storage
pointer.
@par Complexity
Constant.
@ -429,7 +429,7 @@ public:
element-wise copy is performed, which may throw.
In this case, the moved-from array is not
changed.
@par Complexity
At most, linear in `other.size()`.
@ -1224,7 +1224,7 @@ public:
be inserted. This may be the @ref end() iterator.
@param count The number of copies to insert.
@param v The value to insert. Copies will be made
using container's associated @ref memory_resource.
@ -1274,7 +1274,7 @@ public:
@param pos Iterator before which the content will
be inserted. This may be the @ref end() iterator.
@param first An input iterator pointing to the first
element to insert, or pointing to the end of the range.
@ -1318,7 +1318,7 @@ public:
@param pos Iterator before which the content will
be inserted. This may be the @ref end() iterator.
@param init The initializer list to insert
@return An iterator to the first inserted value, or
@ -1351,7 +1351,7 @@ public:
@param pos Iterator before which the element will
be inserted. This may be the @ref end() iterator.
@param arg The argument to forward to the @ref value
constructor.
@ -1476,7 +1476,7 @@ public:
@par Exception Safety
Strong guarantee.
Calls to `memory_resource::allocate` may throw.
@param arg The argument to forward to the @ref value
constructor.
@ -1513,7 +1513,7 @@ public:
@li If `size() < count`, additional null values
are appended.
@par Complexity
Linear in `abs(size() - count)`, plus the cost of
reallocation if @ref capacity() is less than `count`.
@ -1541,7 +1541,7 @@ public:
@li If `size() < count`, additional copies of `v`
are appended.
@par Complexity
Linear in `abs(size() - count)`, plus the cost of
reallocation if @ref capacity() is less than `count`.
@ -1575,7 +1575,7 @@ public:
the contents are logically swapped by making copies,
which can throw. In this case all iterators and
references are invalidated.
@par Complexity
Constant or linear in @ref size() plus `other.size()`.
@ -1610,7 +1610,7 @@ public:
@code
lhs.swap( rhs );
@endcode
@par Complexity
Constant or linear in `lhs.size() + rhs.size()`.
@ -1746,7 +1746,7 @@ namespace std {
template <>
struct hash< ::boost::json::array > {
BOOST_JSON_DECL
std::size_t
std::size_t
operator()(::boost::json::array const& ja) const noexcept;
};
} // std

View File

@ -88,12 +88,12 @@ BOOST_JSON_NS_BEGIN
the error code to a suitable value. This error
code will be returned by the write function to
the caller.
\n
\n
Handlers are required to declare the maximum
limits on various elements. If these limits
are exceeded during parsing, then parsing
fails with an error.
\n
\n
The following declaration meets the parser's
handler requirements:
@ -284,7 +284,7 @@ class basic_parser
obj1, obj2, obj3, obj4,
obj5, obj6, obj7, obj8,
obj9, obj10, obj11,
arr1, arr2, arr3,
arr1, arr2, arr3,
arr4, arr5, arr6,
num1, num2, num3, num4,
num5, num6, num7, num8,
@ -317,7 +317,7 @@ class basic_parser
parse_options opt_;
// how many levels deeper the parser can go
std::size_t depth_ = opt_.max_depth;
inline void reserve();
inline const char* sentinel();
inline bool incomplete(
@ -349,21 +349,21 @@ class basic_parser
inline
const char*
fail(
const char* p,
const char* p,
error ev) noexcept;
BOOST_NOINLINE
inline
const char*
maybe_suspend(
const char* p,
const char* p,
state st);
BOOST_NOINLINE
inline
const char*
maybe_suspend(
const char* p,
const char* p,
state st,
std::size_t n);
@ -453,12 +453,12 @@ class basic_parser
std::integral_constant<bool, StackEmpty_> stack_empty,
std::integral_constant<bool, IsKey_> is_key,
/*std::integral_constant<bool, AllowBadUTF8_>*/ bool allow_bad_utf8);
template<bool StackEmpty_, char First_>
const char* parse_number(const char* p,
std::integral_constant<bool, StackEmpty_> stack_empty,
std::integral_constant<char, First_> first);
template<bool StackEmpty_, bool IsKey_/*,
bool AllowBadUTF8_*/>
const char* parse_unescaped(const char* p,

View File

@ -71,5 +71,5 @@ public:
BOOST_JSON_NS_END
// includes are at the bottom of <boost/json/value.hpp>
#endif

View File

@ -46,22 +46,22 @@
#endif
#ifndef BOOST_JSON_REQUIRE_CONST_INIT
# define BOOST_JSON_REQUIRE_CONST_INIT
# define BOOST_JSON_REQUIRE_CONST_INIT
# if __cpp_constinit >= 201907L
# undef BOOST_JSON_REQUIRE_CONST_INIT
# undef BOOST_JSON_REQUIRE_CONST_INIT
# define BOOST_JSON_REQUIRE_CONST_INIT constinit
# elif defined(__clang__) && defined(__has_cpp_attribute)
# if __has_cpp_attribute(clang::require_constant_initialization)
# undef BOOST_JSON_REQUIRE_CONST_INIT
# define BOOST_JSON_REQUIRE_CONST_INIT [[clang::require_constant_initialization]]
# elif defined(__clang__) && defined(__has_cpp_attribute)
# if __has_cpp_attribute(clang::require_constant_initialization)
# undef BOOST_JSON_REQUIRE_CONST_INIT
# define BOOST_JSON_REQUIRE_CONST_INIT [[clang::require_constant_initialization]]
# endif
# endif
#endif
#ifndef BOOST_JSON_NO_DESTROY
# if defined(__clang__) && defined(__has_cpp_attribute)
# if __has_cpp_attribute(clang::no_destroy)
# define BOOST_JSON_NO_DESTROY [[clang::no_destroy]]
#ifndef BOOST_JSON_NO_DESTROY
# if defined(__clang__) && defined(__has_cpp_attribute)
# if __has_cpp_attribute(clang::no_destroy)
# define BOOST_JSON_NO_DESTROY [[clang::no_destroy]]
# endif
# endif
#endif
@ -79,7 +79,7 @@
# if __has_attribute(noreturn)
# define BOOST_NORETURN [[noreturn]]
# endif
# elif defined(__has_cpp_attribute)
# elif defined(__has_cpp_attribute)
# if __has_cpp_attribute(noreturn)
# define BOOST_NORETURN [[noreturn]]
# endif
@ -184,8 +184,8 @@
#ifndef BOOST_JSON_DECL
#define BOOST_JSON_DECL
#endif
#ifndef BOOST_JSON_CLASS_DECL
#define BOOST_JSON_CLASS_DECL
#ifndef BOOST_JSON_CLASS_DECL
#define BOOST_JSON_CLASS_DECL
#endif
#ifndef BOOST_JSON_LIKELY
@ -212,7 +212,7 @@
# elif defined(__has_builtin)
# if __has_builtin(__builtin_unreachable)
# undef BOOST_JSON_UNREACHABLE
# define BOOST_JSON_UNREACHABLE() __builtin_unreachable()
# define BOOST_JSON_UNREACHABLE() __builtin_unreachable()
# endif
# endif
#endif
@ -230,7 +230,7 @@
# endif
#endif
// older versions of msvc and clang don't always
// older versions of msvc and clang don't always
// constant initialize when they are supposed to
#ifndef BOOST_JSON_WEAK_CONSTINIT
# if defined(_MSC_VER) && ! defined(__clang__) && _MSC_VER < 1920

View File

@ -19,7 +19,7 @@ namespace detail {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // class needs to have dll-interface to be used by clients of class
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
#endif
// A simple memory resource that uses operator new and delete.
@ -52,7 +52,7 @@ public:
reinterpret_cast<std::uintptr_t*>(
&instance_));
}
~default_resource();
void*

View File

@ -13,20 +13,20 @@
BOOST_JSON_NS_BEGIN
namespace detail {
inline
std::size_t
inline
std::size_t
hash_combine(
std::size_t seed,
std::size_t seed,
std::size_t h) noexcept
{
seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U);
return seed;
}
inline
std::size_t
inline
std::size_t
hash_combine_commutative(
std::size_t lhs,
std::size_t lhs,
std::size_t rhs) noexcept
{
return lhs ^ rhs;

View File

@ -19,7 +19,7 @@ namespace detail {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
#endif
struct BOOST_SYMBOL_VISIBLE

View File

@ -42,7 +42,7 @@ count_valid(
while(end - p >= 16)
{
__m128i v1 = _mm_loadu_si128( (__m128i const*)p );
__m128i v1 = _mm_loadu_si128( (__m128i const*)p );
__m128i v2 = _mm_cmpeq_epi8( v1, q1 ); // quote
__m128i v3 = _mm_cmpeq_epi8( v1, q2 ); // backslash
__m128i v4 = _mm_or_si128( v2, v3 ); // combine quotes and backslash
@ -214,7 +214,7 @@ count_unescaped(
while( n >= 16 )
{
__m128i v1 = _mm_loadu_si128( (__m128i const*)s );
__m128i v1 = _mm_loadu_si128( (__m128i const*)s );
__m128i v2 = _mm_cmpeq_epi8( v1, q1 ); // quote
__m128i v3 = _mm_cmpeq_epi8( v1, q2 ); // backslash
__m128i v4 = _mm_or_si128( v2, v3 ); // combine quotes and backslash

View File

@ -158,7 +158,7 @@ public:
{
return p_ < end_;
}
const char* begin() const noexcept
{
return p_;

View File

@ -47,23 +47,23 @@ classify_utf8(char c)
// 0x704 = 4 bytes, second byte [80, 8F]
static constexpr uint16_t first[128]
{
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102,
0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102,
0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102,
0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102,
0x203, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303,
0x303, 0x303, 0x303, 0x303, 0x303, 0x403, 0x303, 0x303,
0x504, 0x604, 0x604, 0x604, 0x704, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
0x000, 0x000, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102,
0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102,
0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102,
0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102, 0x102,
0x203, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303, 0x303,
0x303, 0x303, 0x303, 0x303, 0x303, 0x403, 0x303, 0x303,
0x504, 0x604, 0x604, 0x604, 0x704, 0x000, 0x000, 0x000,
0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
};
return first[static_cast<unsigned char>(c)];
}
@ -136,7 +136,7 @@ public:
std::memcpy(seq_, p, size_);
}
uint8_t
uint8_t
length() const noexcept
{
return first_ & 0xFF;
@ -151,7 +151,7 @@ public:
// returns true if complete
bool
append(
const char* p,
const char* p,
std::size_t remain) noexcept
{
if(BOOST_JSON_UNLIKELY(needed() == 0))

View File

@ -72,7 +72,7 @@ append(InputIt first, InputIt last)
}
// KRYSTIAN TODO: this can be done without copies when
// reallocation is not needed, when the iterator is a
// reallocation is not needed, when the iterator is a
// FowardIterator or better, as we can use std::distance
template<class InputIt, class>
auto
@ -109,7 +109,7 @@ insert(
}
// KRYSTIAN TODO: this can be done without copies when
// reallocation is not needed, when the iterator is a
// reallocation is not needed, when the iterator is a
// FowardIterator or better, as we can use std::distance
template<class InputIt, class>
auto
@ -141,9 +141,9 @@ replace(
cleanup c{tmp, dsp};
std::memcpy(
impl_.replace_unchecked(
first - begin(),
last - first,
tmp.size(),
first - begin(),
last - first,
tmp.size(),
sp_),
tmp.data(),
tmp.size());

View File

@ -22,7 +22,7 @@ BOOST_JSON_NS_BEGIN
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // class needs to have dll-interface to be used by clients of class
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
#endif
//----------------------------------------------------------
@ -85,7 +85,7 @@ BOOST_JSON_NS_BEGIN
class BOOST_JSON_CLASS_DECL
monotonic_resource final
: public memory_resource
{
{
struct block;
struct block_base
{

View File

@ -307,7 +307,7 @@ public:
After construction, the moved-from object behaves
as if newly constructed with its current memory resource.
@par Complexity
Constant.
@ -336,7 +336,7 @@ public:
element-wise copy is performed, which may throw.
In this case, the moved-from object is not
changed.
@par Complexity
Constant or linear in `other.size()`.
@ -362,7 +362,7 @@ public:
This is more efficient than move construction, when
it is known that the moved-from object will be
immediately destroyed afterwards.
@par Complexity
Constant.
@ -944,7 +944,7 @@ public:
@par Exception Safety
Strong guarantee.
Calls to `memory_resource::allocate` may throw.
@param p The value to insert.
@throw std::length_error key is too long.
@ -983,13 +983,13 @@ public:
std::is_constructible_v<value_type, std::iterator_traits<InputIt>::value_type>
@endcode
@par Complexity
@par Complexity
Linear in `std::distance(first, last)`.
@par Exception Safety
Strong guarantee.
Calls to `memory_resource::allocate` may throw.
@param first An input iterator pointing to the first
element to insert, or pointing to the end of the range.
@ -1022,13 +1022,13 @@ public:
that compare equal, only the first equivalent
element will be inserted.
@par Complexity
@par Complexity
Linear in `init.size()`.
@par Exception Safety
Strong guarantee.
Calls to `memory_resource::allocate` may throw.
@param init The initializer list to insert
*/
BOOST_JSON_DECL
@ -1138,7 +1138,7 @@ public:
BOOST_JSON_DECL
iterator
erase(const_iterator pos) noexcept;
/** Erase an element
Remove the element which matches `key`, if it exists.
@ -1566,7 +1566,7 @@ namespace std {
template <>
struct hash< ::boost::json::object > {
BOOST_JSON_DECL
std::size_t
std::size_t
operator()(::boost::json::object const& jo) const noexcept;
};
} // std

View File

@ -78,7 +78,7 @@ parse(
@return A value representing the parsed
JSON upon success.
@param s The string to parse.
@param sp The memory resource that the new value and all

View File

@ -30,7 +30,7 @@ BOOST_JSON_NS_BEGIN
struct parse_options
{
/** Maximum nesting level of arrays and objects.
This specifies the maximum number of nested
structures allowed while parsing a JSON. If
this limit is exceeded during a parse, an

View File

@ -134,7 +134,7 @@ public:
No-throw guarantee.
*/
~parser() = default;
/** Constructor.
This constructs a new parser which first uses

View File

@ -95,7 +95,7 @@ public:
};
#ifndef BOOST_JSON_DOCS
// VFALCO Renamed this to work around an msvc bug
// VFALCO Renamed this to work around an msvc bug
namespace detail_pilfer {
template<class>
struct not_pilfered

View File

@ -18,7 +18,7 @@ BOOST_JSON_NS_BEGIN
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
#pragma warning(disable: 4275) // non dll-interface class used as base for dll-interface class
#endif
//----------------------------------------------------------
@ -65,7 +65,7 @@ BOOST_JSON_NS_BEGIN
class BOOST_JSON_CLASS_DECL
static_resource final
: public memory_resource
{
{
void* p_;
std::size_t n_;
std::size_t size_;

View File

@ -40,7 +40,7 @@ BOOST_JSON_NS_BEGIN
deallocate.
@li Owning, when constructing using the function
@ref make_shared_resource. In this case
@ref make_shared_resource. In this case
ownership is shared; the lifetime of the memory
resource extends until the last copy of the
@ref storage_ptr is destroyed.
@ -68,7 +68,7 @@ BOOST_JSON_NS_BEGIN
@endcode
@par Thread Safety
Instances of this type provide the default level of
thread safety for all C++ objects. Specifically, it
conforms to
@ -489,7 +489,7 @@ make_shared_resource(Args&&... args)
BOOST_STATIC_ASSERT(
std::is_base_of<
memory_resource, T>::value);
return storage_ptr(new
return storage_ptr(new
detail::shared_resource_impl<T>(
std::forward<Args>(args)...));
}

View File

@ -155,7 +155,7 @@ public:
No-throw guarantee.
*/
~stream_parser() = default;
/** Constructor.
This constructs a new parser which first uses

View 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.
@ -90,7 +90,7 @@ value_from(
/** 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`.

View File

@ -61,7 +61,7 @@ class string;
class my_type
{
value jv_;
public:
my_type( std::initializer_list< value_ref > init )
: jv_(init)

View File

@ -183,7 +183,7 @@ public:
Constructs an empty stack. Before any
@ref value can be built, the function
@ref reset must be called.
@ref reset must be called.
The `sp` parameter is only used to allocate
intermediate storage; it will not be used

View File

@ -137,24 +137,24 @@ class basic_parser_test
public:
::test_suite::log_type log;
void
void
grind_one(
string_view s,
bool good,
string_view s,
bool good,
parse_options po)
{
error_code ec;
fail_parser p(po);
p.write(false,
s.data(), s.size(), ec);
BOOST_TEST((good && !ec) ||
BOOST_TEST((good && !ec) ||
(! good && ec));
}
void
void
grind_one(
string_view s,
bool good,
string_view s,
bool good,
const std::vector<parse_options>& configs)
{
for (const parse_options& po : configs)
@ -163,7 +163,7 @@ public:
void
grind(
string_view s,
string_view s,
bool good,
parse_options po)
{
@ -235,7 +235,7 @@ public:
void
grind(
string_view s,
string_view s,
bool good,
const std::vector<parse_options>& configs)
{
@ -257,7 +257,7 @@ public:
void
bad(
string_view s,
string_view s,
const parse_options& po)
{
grind(s, false, po);
@ -286,7 +286,7 @@ public:
{
grind_one(s, true, po);
}
void
bad_one(string_view s)
{
@ -394,7 +394,7 @@ public:
// incomplete
bad ("\"");
// illegal control character
bad ({ "\"" "\x00" "\"", 3 });
bad ("\"" "\x1f" "\"");
@ -842,7 +842,7 @@ public:
void
testIssue113()
{
string_view s =
string_view s =
"\"\\r\\n section id='description'>\\r\\nAll mbers form the uncountable set "
"\\u211D. Among its subsets, relatively simple are the convex sets, each expressed "
"as a range between two real numbers <i>a</i> and <i>b</i> where <i>a</i> \\u2264 <i>"
@ -901,25 +901,25 @@ public:
bool on_bool( bool, error_code& ) { return true; }
bool on_null( error_code& ) { return true; }
bool on_comment_part( string_view s, error_code& )
{
{
captured.append(s.data(), s.size());
return true;
return true;
}
bool on_comment( string_view s, error_code& )
{
bool on_comment( string_view s, error_code& )
{
captured.append(s.data(), s.size());
return true;
return true;
}
};
basic_parser<handler> p_;
public:
comment_parser()
comment_parser()
: p_(make_options(true, false, false))
{
}
std::size_t
write(
char const* data,
@ -947,7 +947,7 @@ public:
parse_options enabled;
enabled.allow_comments = true;
const auto replace_and_test =
const auto replace_and_test =
[&](string_view s)
{
static std::vector<string_view> comments =
@ -978,7 +978,7 @@ public:
{
if (c == '@')
{
string_view com =
string_view com =
comments[((formatted.size() + n) % s.size()) % comments.size()];
formatted.append(com.data(), n = com.size());
just_comments.append(com.data(), com.size());
@ -1319,7 +1319,7 @@ public:
BOOST_TEST(written == write_size);
BOOST_TEST(! ec);
}
BOOST_TEST(p.captured() ==
BOOST_TEST(p.captured() ==
expected.substr(1, expected.size() - 2));
}
};
@ -1351,7 +1351,7 @@ public:
BOOST_TEST(ec == error::too_deep);
}
{
string_view s =
string_view s =
"{\"a\":{\"b\":{\"c\":{}}},\"b\":{\"c\":{\"d\":{\"e\":{}}}}}";
parse_options opt;
opt.max_depth = 4;
@ -1361,7 +1361,7 @@ public:
BOOST_TEST(ec == error::too_deep);
}
{
string_view s =
string_view s =
"{\"a\":{\"b\":{\"c\":{\"d\":{}}}}}";
parse_options opt;
opt.max_depth = 4;
@ -1380,7 +1380,7 @@ public:
constexpr static std::size_t max_array_size = std::size_t(-1);
constexpr static std::size_t max_key_size = std::size_t(-1);
constexpr static std::size_t max_string_size = std::size_t(-1);
std::string captured = "";
bool on_document_begin( error_code& ) { return true; }
bool on_document_end( error_code& ) { return true; }
@ -1392,28 +1392,28 @@ public:
bool on_key( string_view, std::size_t, error_code& ) { return true; }
bool on_string_part( string_view, std::size_t, error_code& ) { return true; }
bool on_string( string_view, std::size_t, error_code& ) { return true; }
bool on_number_part( string_view sv, error_code&)
{
bool on_number_part( string_view sv, error_code&)
{
captured.append(sv.data(), sv.size());
return true;
return true;
}
bool on_int64( std::int64_t, string_view sv, error_code& )
{
{
captured.append(sv.data(), sv.size());
captured += 's';
return true;
return true;
}
bool on_uint64( std::uint64_t, string_view sv, error_code& )
{
bool on_uint64( std::uint64_t, string_view sv, error_code& )
{
captured.append(sv.data(), sv.size());
captured += 'u';
return true;
return true;
}
bool on_double( double, string_view sv, error_code& )
{
{
captured.append(sv.data(), sv.size());
captured += 'd';
return true;
return true;
}
bool on_bool( bool, error_code& ) { return true; }
bool on_null( error_code& ) { return true; }
@ -1424,11 +1424,11 @@ public:
basic_parser<handler> p_;
public:
literal_parser()
literal_parser()
: p_(make_options(true, false, false))
{
}
std::size_t
write(
bool more,
@ -1458,19 +1458,19 @@ public:
{
string_view sv = expected;
sv.remove_suffix(1);
for(std::size_t i = 0;
for(std::size_t i = 0;
i < sv.size(); ++i)
{
literal_parser p;
error_code ec;
if(i != 0)
{
p.write(true,
p.write(true,
sv.data(), i, ec);
}
if(BOOST_TEST(! ec))
{
p.write(false,
p.write(false,
sv.data() + i,
sv.size() - i, ec);
}

View File

@ -139,7 +139,7 @@ private:
return ::operator new( bytes );
}
void do_deallocate( void* ptr, std::size_t bytes, std::size_t align ) override
{
std::cout << "Deallocating " << bytes << " bytes with alignment " << align << " @ address " << ptr << '\n';
@ -153,7 +153,7 @@ private:
// any instance of a logging_resource can deallocate memory allocated
// by another instance of a logging_resource
return dynamic_cast< logging_resource const* >( &other ) != nullptr;
return dynamic_cast< logging_resource const* >( &other ) != nullptr;
}
};
//]

View File

@ -40,7 +40,7 @@ static void set1() {
value jv1 = 1;
assert( jv1.is_int64() );
// construction from unsigned int
value jv2 = 2u;
@ -59,7 +59,7 @@ assert( jv3.is_double() );
value jv = 1;
assert( jv.is_int64() );
// jv.kind() != kind::uint64; throws
std::uint64_t r1 = jv.as_uint64();
@ -156,7 +156,7 @@ assert( ja[0].is_int64() );
// represented by std::int64_t
assert( ja[1].is_int64() );
// contains decimal point, represented as double
assert( ja[2].is_double() );

View File

@ -51,7 +51,7 @@ public:
check(condition::parse_error, error::extra_data);
check(condition::parse_error, error::incomplete);
check(condition::parse_error, error::exponent_overflow);
check(condition::parse_error, error::too_deep);
check(condition::parse_error, error::too_deep);
check(condition::parse_error, error::illegal_leading_surrogate);
check(condition::parse_error, error::illegal_trailing_surrogate);
check(condition::parse_error, error::expected_hex_digit);
@ -64,7 +64,7 @@ public:
check(condition::assign_error, error::not_number);
check(condition::assign_error, error::not_exact);
check(error::test_failure);
}
};

View File

@ -339,7 +339,7 @@ public:
auto jv = parse(js, ec);
BOOST_TEST(ec == error::string_too_large);
}
// object overflow
{
@ -349,7 +349,7 @@ public:
"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,
"20":0
})";
auto jv = parse(s, ec);
BOOST_TEST(ec == error::object_too_large);
}

View File

@ -229,19 +229,19 @@ public:
}
// test if sizes are correctly determined from initial buffers
{
{
{
unsigned char buf[512];
monotonic_resource mr(buf, 512);
BOOST_TEST(all_alloc_in_same_block(mr, 512, 1));
BOOST_TEST(all_alloc_in_same_block(mr, 1024, 1));
}
{
{
unsigned char buf[2048];
monotonic_resource mr(buf, 2048);
BOOST_TEST(all_alloc_in_same_block(mr, 2048, 1));
BOOST_TEST(all_alloc_in_same_block(mr, 4096, 1));
}
{
{
unsigned char buf[4000];
monotonic_resource mr(buf, 4000);
BOOST_TEST(all_alloc_in_same_block(mr, 4000, 1));

View File

@ -102,7 +102,7 @@ public:
monotonic_resource mr1;
static_resource mr2(buf);
storage_ptr sp;
sp = &mr1;
sp = &mr2;
sp = {};

View File

@ -196,9 +196,9 @@ usingValues()
jv = value( array_kind );
assert( jv.is_array() );
jv.emplace_string();
assert( jv.is_string() );
//]
@ -228,7 +228,7 @@ usingValues()
//]
}
catch(...)
catch(...)
{
}
}
@ -304,7 +304,7 @@ usingInitLists()
//[snippet_init_list_4
// Should this be an array or an object?
value jv = { { "hello", 42 }, { "world", 43 } };
value jv = { { "hello", 42 }, { "world", 43 } };
//]
}
@ -329,7 +329,7 @@ usingInitLists()
value jv4 = { { "color", "blue" }, { 1, "red" } };
assert( jv2.is_array() && jv3.is_array() && jv4.is_array() );
//]
}
@ -368,10 +368,10 @@ usingInitLists()
(void)ja;
}
{
//[snippet_init_list_8
object jo = { { "mercury", { { "distance", 36 } } }, { "venus", { 67, "million miles" } }, { "earth", 93 } };
assert( jo["mercury"].is_object() );
@ -383,13 +383,13 @@ usingInitLists()
{
//[snippet_init_list_9
object jo1 = { { "john", 100 }, { "dave", 500 }, { "joe", 300 } };
value jv = { { "clients", std::move(jo1) } };
object& jo2 = jv.as_object()["clients"].as_object();
assert( ! jo2.empty() && jo1.empty() );
assert( serialize(jv) == R"({"clients":{"john":100,"dave":500,"joe":300}})" );
@ -442,7 +442,7 @@ usingArrays()
//]
}
catch (...)
catch (...)
{
}
}
@ -531,10 +531,10 @@ struct vec3
template< class T >
void tag_invoke( const value_from_tag&, value& jv, const vec3<T>& vec )
{
jv = {
{ "x", vec.x },
{ "y", vec.y },
{ "z", vec.z }
jv = {
{ "x", vec.x },
{ "y", vec.y },
{ "z", vec.z }
};
}
@ -668,7 +668,7 @@ usingExchange()
value jv = value_from( positions );
assert( jv.is_object() );
object& jo = jv.as_object();
assert( jo.size() == 3 );
@ -678,7 +678,7 @@ usingExchange()
[]( std::int64_t total, const key_value_pair& jp )
{
assert ( jp.value().is_object() );
const object& pos = jp.value().as_object();
return total + pos.at( "x" ).as_int64() +
@ -686,7 +686,7 @@ usingExchange()
pos.at( "z" ).as_int64();
} ) == 0 );
//]
(void)jo;
@ -726,7 +726,7 @@ usingExchange()
value jv = value_from( available_tools );
assert( jv.is_object() );
//]
}
{

View File

@ -306,7 +306,7 @@ public:
void
static
check_round_trip(value const& jv1,
check_round_trip(value const& jv1,
const parse_options& po = parse_options())
{
auto const s2 =
@ -343,7 +343,7 @@ public:
template<class F>
static
void
grind(string_view s, F const& f,
grind(string_view s, F const& f,
const parse_options& po = parse_options())
{
try
@ -387,7 +387,7 @@ public:
static
void
grind(string_view s,
grind(string_view s,
const parse_options& po = parse_options())
{
grind(s,
@ -533,13 +533,13 @@ public:
if(BOOST_TEST(! ec))
check_round_trip(
p.release());
}
}
}
}
}
//------------------------------------------------------
struct f_boost
{
static
@ -1027,7 +1027,7 @@ R"xx({
}
}
})xx";
string_view out =
string_view out =
"{\"glossary\":{\"title\":\"example glossary\",\"GlossDiv\":"
"{\"title\":\"S\",\"GlossList\":{\"GlossEntry\":{\"ID\":\"SGML\","
"\"SortAs\":\"SGML\",\"GlossTerm\":\"Standard Generalized Markup "
@ -1035,7 +1035,7 @@ R"xx({
"\"GlossDef\":{\"para\":\"A meta-markup language, used to create "
"markup languages such as DocBook.\",\"GlossSeeAlso\":[\"GML\",\"XML\"]},"
"\"GlossSee\":\"markup\"}}}}}";
storage_ptr sp =
storage_ptr sp =
make_shared_resource<monotonic_resource>();
stream_parser p(sp);
error_code ec;
@ -1046,7 +1046,7 @@ R"xx({
BOOST_TEST(serialize(p.release()) == out);
}
void
void
testTrailingCommas()
{
parse_options enabled;
@ -1096,7 +1096,7 @@ R"xx({
grind("{\"a\":1// c++ \n, \"b\":2}", enabled);
grind("{\"a\":1, // c++ \n \"b\":2}", enabled);
grind("{\"a\"// c++ \n:1}", enabled);
grind("{\"a\":// c++ \n1}", enabled);
grind("{\"a\":// c++ \n1}", enabled);
}
void

View File

@ -182,7 +182,7 @@ public:
}
explicit
null_parser(parse_options po)
null_parser(parse_options po)
: p_(po)
{
}
@ -281,7 +281,7 @@ class fail_parser
bool
on_key_part(
string_view,
std::size_t,
std::size_t,
error_code& ec)
{
return maybe_fail(ec);
@ -290,16 +290,16 @@ class fail_parser
bool
on_key(
string_view,
std::size_t,
std::size_t,
error_code& ec)
{
return maybe_fail(ec);
}
bool
on_string_part(
string_view,
std::size_t,
std::size_t,
error_code& ec)
{
return maybe_fail(ec);
@ -308,7 +308,7 @@ class fail_parser
bool
on_string(
string_view,
std::size_t,
std::size_t,
error_code& ec)
{
return maybe_fail(ec);
@ -363,19 +363,19 @@ class fail_parser
return maybe_fail(ec);
}
bool
bool
on_comment_part(
string_view,
error_code& ec)
{
return maybe_fail(ec);
string_view,
error_code& ec)
{
return maybe_fail(ec);
}
bool
on_comment(
string_view,
error_code& ec)
{
string_view,
error_code& ec)
{
return maybe_fail(ec);
}
};
@ -525,7 +525,7 @@ class throw_parser
bool
on_key_part(
string_view,
std::size_t,
std::size_t,
error_code&)
{
return maybe_throw();
@ -534,16 +534,16 @@ class throw_parser
bool
on_key(
string_view,
std::size_t,
std::size_t,
error_code&)
{
return maybe_throw();
}
bool
on_string_part(
string_view,
std::size_t,
std::size_t,
error_code&)
{
return maybe_throw();
@ -552,7 +552,7 @@ class throw_parser
bool
on_string(
string_view,
std::size_t,
std::size_t,
error_code&)
{
return maybe_throw();
@ -607,19 +607,19 @@ class throw_parser
return maybe_throw();
}
bool
bool
on_comment_part(
string_view,
error_code&)
{
return maybe_throw();
string_view,
error_code&)
{
return maybe_throw();
}
bool
on_comment(
string_view,
error_code&)
{
string_view,
error_code&)
{
return maybe_throw();
}
};
@ -1059,11 +1059,11 @@ bool
check_hash_equal(
T const& lhs,
T const& rhs)
{
{
if(lhs == rhs){
return (std::hash<T>{}(lhs) == std::hash<T>{}(rhs));
}
return false; // ensure lhs == rhs intention
return false; // ensure lhs == rhs intention
}
template<typename T, typename U>
@ -1076,7 +1076,7 @@ check_hash_equal(
if(lhs == rhs){
return (std::hash<value>{}(lhs) == std::hash<value>{}(rhs));
}
return false; // ensure lhs == rhs intention
return false; // ensure lhs == rhs intention
}
template<typename T>

View File

@ -574,7 +574,7 @@ struct instance
{
auto const saved =
current();
//current()->os_
//current()->os_
T().run();
current() = saved;
}

View File

@ -24,7 +24,7 @@ BOOST_JSON_NS_BEGIN
class my_type
{
json::value jv_;
public:
my_type( std::initializer_list< json::value_ref > init )
: jv_(init)
@ -116,7 +116,7 @@ public:
(void)value_ref(std::move(val));
}
}
void
testInitList()
{
@ -189,14 +189,14 @@ public:
string const s{};
(void)init_list{s};
}
// init_list
(void)init_list{{1,2,3,4,5}};
(void)init_list{{{1,2},{3,4,5}}};
(void)init_list{{1,2,{3,{4,5}}}};
{
init_list init =
init_list init =
{ { "key", true } };
(void)init;
}