Skip to content

Commit bacc644

Browse files
committed
deprecate type aliases
1 parent 411b9a9 commit bacc644

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1418
-1351
lines changed

bench/bench.cpp

+30-30
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class boost_default_impl : public any_impl
298298
while(repeat--)
299299
{
300300
p.reset();
301-
error_code ec;
301+
system::error_code ec;
302302
p.write(s.data(), s.size(), ec);
303303
if(! ec)
304304
p.finish(ec);
@@ -320,7 +320,7 @@ class boost_default_impl : public any_impl
320320

321321
FILE* f = fopen(fi.name.data(), "rb");
322322

323-
error_code ec;
323+
system::error_code ec;
324324
while( true )
325325
{
326326
std::size_t const sz = fread(s, 1, sizeof(s), f);
@@ -412,7 +412,7 @@ class boost_pool_impl : public any_impl
412412
{
413413
monotonic_resource mr;
414414
p.reset(&mr);
415-
error_code ec;
415+
system::error_code ec;
416416
p.write(s.data(), s.size(), ec);
417417
if(! ec)
418418
p.finish(ec);
@@ -435,7 +435,7 @@ class boost_pool_impl : public any_impl
435435

436436
FILE* f = fopen(fi.name.data(), "rb");
437437

438-
error_code ec;
438+
system::error_code ec;
439439
while( true )
440440
{
441441
std::size_t const sz = fread(s, 1, sizeof(s), f);
@@ -509,24 +509,24 @@ class boost_null_impl : public any_impl
509509
constexpr static std::size_t max_key_size = std::size_t(-1);
510510
constexpr static std::size_t max_string_size = std::size_t(-1);
511511

512-
bool on_document_begin(error_code&) { return true; }
513-
bool on_document_end(error_code&) { return true; }
514-
bool on_object_begin(error_code&) { return true; }
515-
bool on_object_end(std::size_t, error_code&) { return true; }
516-
bool on_array_begin(error_code&) { return true; }
517-
bool on_array_end(std::size_t, error_code&) { return true; }
518-
bool on_key_part(string_view, std::size_t, error_code&) { return true; }
519-
bool on_key( string_view, std::size_t, error_code&) { return true; }
520-
bool on_string_part(string_view, std::size_t, error_code&) { return true; }
521-
bool on_string(string_view, std::size_t, error_code&) { return true; }
522-
bool on_number_part(string_view, error_code&) { return true; }
523-
bool on_int64(std::int64_t, string_view, error_code&) { return true; }
524-
bool on_uint64(std::uint64_t, string_view, error_code&) { return true; }
525-
bool on_double(double, string_view, error_code&) { return true; }
526-
bool on_bool(bool, error_code&) { return true; }
527-
bool on_null(error_code&) { return true; }
528-
bool on_comment_part(string_view, error_code&) { return true; }
529-
bool on_comment(string_view, error_code&) { return true; }
512+
bool on_document_begin(system::error_code&) { return true; }
513+
bool on_document_end(system::error_code&) { return true; }
514+
bool on_object_begin(system::error_code&) { return true; }
515+
bool on_object_end(std::size_t, system::error_code&) { return true; }
516+
bool on_array_begin(system::error_code&) { return true; }
517+
bool on_array_end(std::size_t, system::error_code&) { return true; }
518+
bool on_key_part(string_view, std::size_t, system::error_code&) { return true; }
519+
bool on_key( string_view, std::size_t, system::error_code&) { return true; }
520+
bool on_string_part(string_view, std::size_t, system::error_code&) { return true; }
521+
bool on_string(string_view, std::size_t, system::error_code&) { return true; }
522+
bool on_number_part(string_view, system::error_code&) { return true; }
523+
bool on_int64(std::int64_t, string_view, system::error_code&) { return true; }
524+
bool on_uint64(std::uint64_t, string_view, system::error_code&) { return true; }
525+
bool on_double(double, string_view, system::error_code&) { return true; }
526+
bool on_bool(bool, system::error_code&) { return true; }
527+
bool on_null(system::error_code&) { return true; }
528+
bool on_comment_part(string_view, system::error_code&) { return true; }
529+
bool on_comment(string_view, system::error_code&) { return true; }
530530
};
531531

532532
basic_parser<handler> p_;
@@ -546,7 +546,7 @@ class boost_null_impl : public any_impl
546546
write(
547547
char const* data,
548548
std::size_t size,
549-
error_code& ec)
549+
system::error_code& ec)
550550
{
551551
auto const n = p_.write_some(
552552
false, data, size, ec);
@@ -559,14 +559,14 @@ class boost_null_impl : public any_impl
559559
write_some(
560560
char const* data,
561561
std::size_t size,
562-
error_code& ec)
562+
system::error_code& ec)
563563
{
564564
return p_.write_some(
565565
true, data, size, ec);
566566
}
567567

568568
void
569-
finish(error_code& ec)
569+
finish(system::error_code& ec)
570570
{
571571
p_.write_some(false, nullptr, 0, ec);
572572
}
@@ -599,7 +599,7 @@ class boost_null_impl : public any_impl
599599
while(repeat--)
600600
{
601601
p.reset();
602-
error_code ec;
602+
system::error_code ec;
603603
p.write(s.data(), s.size(), ec);
604604
BOOST_ASSERT(! ec);
605605
}
@@ -618,7 +618,7 @@ class boost_null_impl : public any_impl
618618

619619
FILE* f = fopen(fi.name.data(), "rb");
620620

621-
error_code ec;
621+
system::error_code ec;
622622
while( true )
623623
{
624624
std::size_t const sz = fread(s, 1, sizeof(s), f);
@@ -679,7 +679,7 @@ class boost_simple_impl : public any_impl
679679
auto const start = clock_type::now();
680680
while(repeat--)
681681
{
682-
error_code ec;
682+
system::error_code ec;
683683
monotonic_resource mr;
684684
auto jv = json::parse(s, ec, &mr, popts);
685685
(void)jv;
@@ -693,7 +693,7 @@ class boost_simple_impl : public any_impl
693693
auto const start = clock_type::now();
694694
while(repeat--)
695695
{
696-
error_code ec;
696+
system::error_code ec;
697697
std::ifstream is( fi.name, std::ios::in | std::ios::binary );
698698
monotonic_resource mr;
699699
auto jv = json::parse(is, ec, &mr, popts);
@@ -1188,7 +1188,7 @@ main(
11881188

11891189
dout << "\n" << strout.str();
11901190
}
1191-
catch(system_error const& se)
1191+
catch(boost::system::system_error const& se)
11921192
{
11931193
dout << se.what() << std::endl;
11941194
}

doc/qbk/allocators/background.qbk

+13-13
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ definitions must be visible at all call sites.
3939
[heading Polymorphic Allocators]
4040

4141
C++17 improves the allocator model by representing the low-level
42-
allocation operation with an abstract interface called __memory_resource__,
42+
allocation operation with an abstract interface called `memory_resource`,
4343
which is not parameterized on the element type, and has no traits:
4444

4545
[doc_background_3]
4646

47-
The class template __polymorphic_allocator__ wraps a __memory_resource__
47+
The class template `polymorphic_allocator` wraps a `memory_resource`
4848
pointer and meets the requirements of __Allocator__, allowing it to be
4949
used where an allocator is expected. The standard provides type aliases
5050
using the polymorphic allocator for standard containers:
@@ -71,28 +71,28 @@ instance of the library's custom memory resource as shown below:
7171

7272
[doc_background_7]
7373

74-
This can be worked around by declaring the container to use a custom
75-
allocator (perhaps using a `std::shared_ptr< memory_resource >` as a
76-
data member). This hinders library composition; every library now
77-
exports unique, incompatible container types. A raw memory resource
78-
pointer is also easy to misuse:
74+
This can be worked around by declaring the container to use a custom allocator
75+
(perhaps using a `std::shared_ptr< std::pmr::memory_resource >` as
76+
a data member). This hinders library composition; every library now exports
77+
unique, incompatible container types. A raw memory resource pointer is also
78+
easy to misuse:
7979

8080
[doc_background_8]
8181

8282
Workarounds for this problem are worse than the problem itself. The library
83-
could return a pair with the vector and `unique_ptr<memory_resource>`
84-
which the caller must manage. Or the library could change its function
85-
signatures to accept a `memory_resource*` provided by the caller, where
86-
the library also makes public the desired memory resources
87-
(`my_resource` above).
83+
could return a pair with the vector and
84+
`std::unique_ptr<std::pmr::memory_resource>` which the caller must
85+
manage. Or the library could change its function signatures to accept a
86+
`memory_resource*` provided by the caller, where the library also makes public
87+
the desired memory resources (`my_resource` above).
8888

8989
[heading Problem Statement]
9090

9191
We would like an allocator model using a single type `T` with the
9292
following properties:
9393

9494
* `T` is not a class template
95-
* `T` references a __memory_resource__
95+
* `T` references a `memory_resource`
9696
* `T` supports both reference semantics or shared ownership
9797
* `T` interoperates with code already using `std::pmr`
9898

doc/qbk/quickref.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@
105105
<entry valign="top">
106106
<bridgehead renderas="sect3">Aliases</bridgehead>
107107
<simplelist type="vert" columns="1">
108-
<member><link linkend="json.ref.boost__json__error_category">error_category</link></member>
109-
<member><link linkend="json.ref.boost__json__error_code">error_code</link></member>
110-
<member><link linkend="json.ref.boost__json__error_condition">error_condition</link></member>
111-
<member><link linkend="json.ref.boost__json__memory_resource">memory_resource</link></member>
108+
<member><link linkend="json.ref.boost__json__error_category"><emphasis role="red">error_category</emphasis></link></member>
109+
<member><link linkend="json.ref.boost__json__error_code"><emphasis role="red">error_code</emphasis></link></member>
110+
<member><link linkend="json.ref.boost__json__error_condition"><emphasis role="red">error_condition</emphasis></link></member>
111+
<member><link linkend="json.ref.boost__json__memory_resource"><emphasis role="red">memory_resource</emphasis></link></member>
112112
<member><link linkend="json.ref.boost__json__parser_for">parser_for</link></member>
113-
<member><link linkend="json.ref.boost__json__polymorphic_allocator">polymorphic_allocator</link></member>
114-
<member><link linkend="json.ref.boost__json__result">result</link></member>
113+
<member><link linkend="json.ref.boost__json__polymorphic_allocator"><emphasis role="red">polymorphic_allocator</emphasis></link></member>
114+
<member><link linkend="json.ref.boost__json__result"><emphasis role="red">result</emphasis></link></member>
115115
<member><link linkend="json.ref.boost__json__string_view">string_view</link></member>
116-
<member><link linkend="json.ref.boost__json__system_error">system_error</link></member>
116+
<member><link linkend="json.ref.boost__json__system_error"><emphasis role="red">system_error</emphasis></link></member>
117117
</simplelist>
118118
<bridgehead renderas="sect3">P0308R0</bridgehead>
119119
<simplelist type="vert" columns="1">

example/file.hpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class file
2020
long size_ = 0;
2121

2222
void
23-
fail(boost::json::error_code& ec)
23+
fail(boost::system::error_code& ec)
2424
{
2525
ec.assign( errno, boost::system::generic_category() );
2626
}
@@ -69,7 +69,7 @@ class file
6969
open(
7070
char const* path,
7171
char const* mode,
72-
boost::json::error_code& ec)
72+
boost::system::error_code& ec)
7373
{
7474
close();
7575
#if defined(_MSC_VER)
@@ -99,10 +99,10 @@ class file
9999
char const* path,
100100
char const* mode)
101101
{
102-
boost::json::error_code ec;
102+
boost::system::error_code ec;
103103
open(path, mode, ec);
104104
if(ec)
105-
throw boost::json::system_error(ec);
105+
throw boost::system::system_error(ec);
106106
}
107107

108108
long
@@ -118,7 +118,7 @@ class file
118118
}
119119

120120
std::size_t
121-
read( char* data, std::size_t size, boost::json::error_code& ec)
121+
read( char* data, std::size_t size, boost::system::error_code& ec)
122122
{
123123
auto const nread = std::fread( data, 1, size, f_ );
124124
if( std::ferror(f_) )
@@ -129,17 +129,17 @@ class file
129129
std::size_t
130130
read( char* data, std::size_t size )
131131
{
132-
boost::json::error_code ec;
132+
boost::system::error_code ec;
133133
auto const nread = read( data, size, ec );
134134
if(ec)
135-
throw boost::json::system_error(ec);
135+
throw boost::system::system_error(ec);
136136
return nread;
137137
}
138138
};
139139

140140
inline
141141
std::string
142-
read_file( char const* path, boost::json::error_code& ec )
142+
read_file( char const* path, boost::system::error_code& ec )
143143
{
144144
file f;
145145
f.open( path, "r", ec );
@@ -157,10 +157,10 @@ inline
157157
std::string
158158
read_file( char const* path )
159159
{
160-
boost::json::error_code ec;
160+
boost::system::error_code ec;
161161
auto s = read_file( path, ec);
162162
if(ec)
163-
throw boost::json::system_error(ec);
163+
throw boost::system::system_error(ec);
164164
return s;
165165
}
166166

example/parse_into.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int main()
176176

177177
coordinates1 w;
178178

179-
boost::json::error_code ec;
179+
boost::system::error_code ec;
180180
boost::json::parse_into( w, json, ec );
181181

182182
if( ec.failed() )
@@ -212,7 +212,7 @@ int main()
212212

213213
coordinates2 w;
214214

215-
boost::json::error_code ec;
215+
boost::system::error_code ec;
216216
boost::json::parse_into( w, json, ec );
217217

218218
if( ec.failed() )

example/parse_into_canada.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int main()
8282

8383
canada w;
8484

85-
boost::json::error_code ec;
85+
boost::system::error_code ec;
8686
boost::json::parse_into( w, json, ec );
8787

8888
if( ec.failed() )

example/parse_into_citm_catalog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ int main()
129129

130130
citm_catalog w;
131131

132-
boost::json::error_code ec;
132+
boost::system::error_code ec;
133133
boost::json::parse_into( w, json, ec );
134134

135135
if( ec.failed() )

example/pretty.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ parse_file( char const* filename )
2727
{
2828
file f( filename, "r" );
2929
json::stream_parser p;
30-
json::error_code ec;
30+
boost::system::error_code ec;
3131
do
3232
{
3333
char buf[4096];

example/use_allocator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ template<
4242
is_sequence_like<T>::value &&
4343
std::uses_allocator<T, Alloc>::value
4444
>::type >
45-
result<T>
45+
boost::system::result<T>
4646
tag_invoke( try_value_to_tag<T>, const value& jv, const use_allocator_t<Alloc>& ctx, const FullContext& full_ctx )
4747
{
4848

0 commit comments

Comments
 (0)