Skip to content

Commit 26d3f2c

Browse files
authored
Merge pull request p12tic#128 from p12tic/headers-int-types-in-global-ns
Headers: Put integer typedefs to global namespace too by default
2 parents 6f0c83b + c852a32 commit 26d3f2c

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

headers/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ macros:
3232
values are 1998, 2003, 2011, 2014, 2017 which correspond to the respective
3333
C++ standards.
3434

35+
- CPPREFERENCE_INT_TYPES_ONLY_IN_STD: non-zero value results in integer types
36+
such as std::size_t, std::uint16_t and so on being defined only in std
37+
namespace.
38+
3539
- CPPREFERENCE_SIMPLIFY_TYPEDEFS: non-zero value results in simplified
3640
typedefs being exposed. Usage of various traits is greatly reduced; the
3741
typedefs refer to types that would be resolved in most common cases.

headers/cstddef

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,10 @@ typedef decltype(nullptr) nullptr_t;
3838
#endif
3939
} // namespace std
4040

41+
#if !CPPREFERENCE_INT_TYPES_ONLY_IN_STD
42+
using std::ptrdiff_t;
43+
using std::size_t;
44+
using std::max_align_t;
45+
#endif // !CPPREFERENCE_INT_TYPES_ONLY_IN_STD
46+
4147
#endif // CPPREFERENCE_CSTDDEF_H

headers/cstdint

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,36 @@ typedef unsigned long long uintmax_t;
142142
} // namespace std
143143
#endif // CPPREFERENCE_STDVER>= 2011
144144

145+
#if !CPPREFERENCE_INT_TYPES_ONLY_IN_STD
146+
using std::int8_t;
147+
using std::int16_t;
148+
using std::int32_t;
149+
using std::int64_t;
150+
using std::uint8_t;
151+
using std::uint16_t;
152+
using std::uint32_t;
153+
using std::uint64_t;
154+
using std::int_fast8_t;
155+
using std::int_fast16_t;
156+
using std::int_fast32_t;
157+
using std::int_fast64_t;
158+
using std::uint_fast8_t;
159+
using std::uint_fast16_t;
160+
using std::uint_fast32_t;
161+
using std::uint_fast64_t;
162+
using std::int_least8_t;
163+
using std::int_least16_t;
164+
using std::int_least32_t;
165+
using std::int_least64_t;
166+
using std::uint_least8_t;
167+
using std::uint_least16_t;
168+
using std::uint_least32_t;
169+
using std::uint_least64_t;
170+
171+
using std::intptr_t;
172+
using std::uintptr_t;
173+
using std::intmax_t;
174+
using std::uintmax_t;
175+
#endif
176+
145177
#endif // CPPREFERENCE_CSTDINT_H

0 commit comments

Comments
 (0)