Skip to content

Commit 5b3d75e

Browse files
committed
Add inline namespace
1 parent a01fe3b commit 5b3d75e

Some content is hidden

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

51 files changed

+289
-6
lines changed

include/toml11/compat.hpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363

6464
namespace toml
6565
{
66+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
67+
{
6668
namespace cxx
6769
{
6870

@@ -81,6 +83,7 @@ std::unique_ptr<T> make_unique(Ts&& ... args)
8183
#endif // TOML11_HAS_STD_MAKE_UNIQUE
8284

8385
} // cxx
86+
} // TOML11_INLINE_VERSION_NAMESPACE
8487
} // toml
8588

8689
// ---------------------------------------------------------------------------
@@ -95,6 +98,8 @@ std::unique_ptr<T> make_unique(Ts&& ... args)
9598

9699
namespace toml
97100
{
101+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
102+
{
98103
namespace cxx
99104
{
100105
# if defined(TOML11_HAS_STD_MAKE_REVERSE_ITERATOR)
@@ -112,6 +117,7 @@ std::reverse_iterator<Iterator> make_reverse_iterator(Iterator iter)
112117
#endif // TOML11_HAS_STD_MAKE_REVERSE_ITERATOR
113118

114119
} // cxx
120+
} // TOML11_INLINE_VERSION_NAMESPACE
115121
} // toml
116122

117123
// ---------------------------------------------------------------------------
@@ -126,6 +132,8 @@ std::reverse_iterator<Iterator> make_reverse_iterator(Iterator iter)
126132

127133
namespace toml
128134
{
135+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
136+
{
129137
namespace cxx
130138
{
131139
#if defined(TOML11_HAS_STD_CLAMP)
@@ -144,6 +152,7 @@ T clamp(const T& x, const T& low, const T& high) noexcept
144152
#endif // TOML11_HAS_STD_CLAMP
145153

146154
} // cxx
155+
} // TOML11_INLINE_VERSION_NAMESPACE
147156
} // toml
148157

149158
// ---------------------------------------------------------------------------
@@ -158,6 +167,8 @@ T clamp(const T& x, const T& low, const T& high) noexcept
158167

159168
namespace toml
160169
{
170+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
171+
{
161172
namespace cxx
162173
{
163174
#if defined(TOML11_HAS_STD_BIT_CAST)
@@ -183,6 +194,7 @@ U bit_cast(const T& x) noexcept
183194
#endif // TOML11_HAS_STD_BIT_CAST
184195

185196
} // cxx
197+
} // TOML11_INLINE_VERSION_NAMESPACE
186198
} // toml
187199

188200
// ---------------------------------------------------------------------------
@@ -198,6 +210,8 @@ U bit_cast(const T& x) noexcept
198210

199211
namespace toml
200212
{
213+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
214+
{
201215
namespace cxx
202216
{
203217
#if defined(TOML11_HAS_STD_REMOVE_CVREF)
@@ -220,6 +234,7 @@ using remove_cvref_t = typename remove_cvref<T>::type;
220234
#endif // TOML11_HAS_STD_REMOVE_CVREF
221235

222236
} // cxx
237+
} // TOML11_INLINE_VERSION_NAMESPACE
223238
} // toml
224239

225240
// ---------------------------------------------------------------------------
@@ -235,6 +250,8 @@ using remove_cvref_t = typename remove_cvref<T>::type;
235250

236251
namespace toml
237252
{
253+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
254+
{
238255
namespace cxx
239256
{
240257
#if defined(TOML11_HAS_STD_CONJUNCTION)
@@ -265,6 +282,7 @@ struct negation : std::integral_constant<bool, !static_cast<bool>(T::value)>{};
265282
#endif // TOML11_HAS_STD_CONJUNCTION
266283

267284
} // cxx
285+
} // TOML11_INLINE_VERSION_NAMESPACE
268286
} // toml
269287

270288
// ---------------------------------------------------------------------------
@@ -280,6 +298,8 @@ struct negation : std::integral_constant<bool, !static_cast<bool>(T::value)>{};
280298

281299
namespace toml
282300
{
301+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
302+
{
283303
namespace cxx
284304
{
285305
#if defined(TOML11_HAS_STD_INTEGER_SEQUENCE)
@@ -324,6 +344,7 @@ using make_index_sequence = typename index_sequence_maker<N>::type;
324344
#endif // TOML11_HAS_STD_INTEGER_SEQUENCE
325345

326346
} // cxx
347+
} // TOML11_INLINE_VERSION_NAMESPACE
327348
} // toml
328349

329350
// ---------------------------------------------------------------------------
@@ -339,6 +360,8 @@ using make_index_sequence = typename index_sequence_maker<N>::type;
339360

340361
namespace toml
341362
{
363+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
364+
{
342365
namespace cxx
343366
{
344367
#if defined(TOML11_HAS_STD_ENABLE_IF_T)
@@ -353,6 +376,7 @@ using enable_if_t = typename std::enable_if<B, T>::type;
353376
#endif // TOML11_HAS_STD_ENABLE_IF_T
354377

355378
} // cxx
379+
} // TOML11_INLINE_VERSION_NAMESPACE
356380
} // toml
357381

358382
// ---------------------------------------------------------------------------
@@ -368,6 +392,8 @@ using enable_if_t = typename std::enable_if<B, T>::type;
368392

369393
namespace toml
370394
{
395+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
396+
{
371397
namespace cxx
372398
{
373399
#if defined(TOML11_HAS_STD_INVOKE_RESULT)
@@ -384,6 +410,7 @@ using return_type_of_t = typename std::result_of<F(Args...)>::type;
384410
#endif // TOML11_HAS_STD_INVOKE_RESULT
385411

386412
} // cxx
413+
} // TOML11_INLINE_VERSION_NAMESPACE
387414
} // toml
388415

389416
// ---------------------------------------------------------------------------
@@ -399,6 +426,8 @@ using return_type_of_t = typename std::result_of<F(Args...)>::type;
399426

400427
namespace toml
401428
{
429+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
430+
{
402431
namespace cxx
403432
{
404433
#if defined(TOML11_HAS_STD_VOID_T)
@@ -413,6 +442,7 @@ using void_t = void;
413442
#endif // TOML11_HAS_STD_VOID_T
414443

415444
} // cxx
445+
} // TOML11_INLINE_VERSION_NAMESPACE
416446
} // toml
417447

418448
// ----------------------------------------------------------------------------
@@ -457,6 +487,8 @@ using void_t = void;
457487
#include <source_location>
458488
namespace toml
459489
{
490+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
491+
{
460492
namespace cxx
461493
{
462494
using source_location = std::source_location;
@@ -477,11 +509,14 @@ inline std::string to_string(const source_location& loc)
477509
}
478510

479511
} // cxx
512+
} // TOML11_INLINE_VERSION_NAMESPACE
480513
} // toml
481514
#elif defined(TOML11_HAS_EXPERIMENTAL_SOURCE_LOCATION)
482515
#include <experimental/source_location>
483516
namespace toml
484517
{
518+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
519+
{
485520
namespace cxx
486521
{
487522
using source_location = std::experimental::source_location;
@@ -502,10 +537,13 @@ inline std::string to_string(const source_location& loc)
502537
}
503538

504539
} // cxx
540+
} // TOML11_INLINE_VERSION_NAMESPACE
505541
} // toml
506542
#elif defined(TOML11_HAS_BUILTIN_FILE_LINE)
507543
namespace toml
508544
{
545+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
546+
{
509547
namespace cxx
510548
{
511549
struct source_location
@@ -546,10 +584,13 @@ inline std::string to_string(const source_location& loc)
546584
}
547585

548586
} // cxx
587+
} // TOML11_INLINE_VERSION_NAMESPACE
549588
} // toml
550589
#else // no builtin
551590
namespace toml
552591
{
592+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
593+
{
553594
namespace cxx
554595
{
555596
struct source_location
@@ -562,6 +603,7 @@ inline std::string to_string(const source_location&)
562603
return std::string("");
563604
}
564605
} // cxx
606+
} // TOML11_INLINE_VERSION_NAMESPACE
565607
} // toml
566608
#endif // TOML11_HAS_STD_SOURCE_LOCATION
567609

@@ -586,6 +628,8 @@ inline std::string to_string(const source_location&)
586628

587629
namespace toml
588630
{
631+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
632+
{
589633
namespace cxx
590634
{
591635
using std::optional;
@@ -601,12 +645,15 @@ operator<<(std::basic_ostream<charT, traitsT>& os, const std::nullopt_t&)
601645
}
602646

603647
} // cxx
648+
} // TOML11_INLINE_VERSION_NAMESPACE
604649
} // toml
605650

606651
#else // TOML11_HAS_STD_OPTIONAL
607652

608653
namespace toml
609654
{
655+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
656+
{
610657
namespace cxx
611658
{
612659

@@ -804,6 +851,7 @@ class optional
804851
};
805852
};
806853
} // cxx
854+
} // TOML11_INLINE_VERSION_NAMESPACE
807855
} // toml
808856
#endif // TOML11_HAS_STD_OPTIONAL
809857

include/toml11/context.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
namespace toml
1010
{
11+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
12+
{
1113
namespace detail
1214
{
1315

@@ -50,18 +52,22 @@ class context
5052
};
5153

5254
} // detail
55+
} // TOML11_INLINE_VERSION_NAMESPACE
5356
} // toml
5457

5558
#if defined(TOML11_COMPILE_SOURCES)
5659
namespace toml
5760
{
61+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
62+
{
5863
struct type_config;
5964
struct ordered_type_config;
6065
namespace detail
6166
{
6267
extern template class context<::toml::type_config>;
6368
extern template class context<::toml::ordered_type_config>;
6469
} // detail
70+
} // TOML11_INLINE_VERSION_NAMESPACE
6571
} // toml
6672
#endif // TOML11_COMPILE_SOURCES
6773

include/toml11/conversion.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
#include "find.hpp"
55
#include "from.hpp" // IWYU pragma: keep
66
#include "into.hpp" // IWYU pragma: keep
7+
#include "version.hpp"
78

89
#if defined(TOML11_HAS_OPTIONAL)
910

1011
#include <optional>
1112

1213
namespace toml
1314
{
15+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
16+
{
1417
namespace detail
1518
{
1619

@@ -57,12 +60,15 @@ void assign_member_variable_to_value(const T& obj, basic_value<TC>& v, const cha
5760
}
5861

5962
} // detail
63+
} // TOML11_INLINE_VERSION_NAMESPACE
6064
} // toml
6165

6266
#else
6367

6468
namespace toml
6569
{
70+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
71+
{
6672
namespace detail
6773
{
6874

@@ -79,6 +85,7 @@ void assign_member_variable_to_value(const T& obj, basic_value<TC>& v, const cha
7985
}
8086

8187
} // detail
88+
} // TOML11_INLINE_VERSION_NAMESPACE
8289
} // toml
8390

8491
#endif // optional
@@ -174,6 +181,7 @@ void assign_member_variable_to_value(const T& obj, basic_value<TC>& v, const cha
174181

175182
#define TOML11_DEFINE_CONVERSION_NON_INTRUSIVE(NAME, ...)\
176183
namespace toml { \
184+
namespace TOML11_INLINE_VERSION_NAMESPACE { \
177185
template<> \
178186
struct from<NAME> \
179187
{ \
@@ -196,6 +204,7 @@ void assign_member_variable_to_value(const T& obj, basic_value<TC>& v, const cha
196204
return v; \
197205
} \
198206
}; \
207+
} /* TOML11_INLINE_VERSION_NAMESPACE */ \
199208
} /* toml */
200209

201210
#endif// TOML11_WITHOUT_DEFINE_NON_INTRUSIVE

include/toml11/exception.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33

44
#include <exception>
55

6+
#include "version.hpp"
7+
68
namespace toml
79
{
10+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
11+
{
812

913
struct exception : public std::exception
1014
{
@@ -13,5 +17,6 @@ struct exception : public std::exception
1317
virtual const char* what() const noexcept override {return "";}
1418
};
1519

20+
} // TOML11_INLINE_VERSION_NAMESPACE
1621
} // toml
1722
#endif // TOMl11_EXCEPTION_HPP

include/toml11/find.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55

66
#include "get.hpp"
77
#include "value.hpp"
8+
#include "version.hpp"
89

910
#if defined(TOML11_HAS_STRING_VIEW)
1011
#include <string_view>
1112
#endif
1213

1314
namespace toml
1415
{
16+
inline namespace TOML11_INLINE_VERSION_NAMESPACE
17+
{
1518

1619
// ----------------------------------------------------------------------------
1720
// find<T>(value, key);
@@ -584,5 +587,6 @@ find_or_default(const basic_value<TC>& v, K1&& k1, Ks&& ... keys) noexcept(std::
584587
}
585588
}
586589

590+
} // TOML11_INLINE_VERSION_NAMESPACE
587591
} // toml
588592
#endif // TOML11_FIND_HPP

0 commit comments

Comments
 (0)