Skip to content

Commit c048a15

Browse files
committed
Remove _fast and _small types, fix lambda return type to be decltype(auto)
We don't really need `_small`, and we can add `_fast` back if there's really a clear need
1 parent 98ae2b9 commit c048a15

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

include/cpp2util.h

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -241,26 +241,6 @@ using u16 = std::uint16_t ;
241241
using u32 = std::uint32_t ;
242242
using u64 = std::uint64_t ;
243243

244-
// Rarely, when really needed for speed optimization: Fastest type with at least N bits
245-
using i8_fast = std::int_fast8_t ;
246-
using i16_fast = std::int_fast16_t ;
247-
using i32_fast = std::int_fast32_t ;
248-
using i64_fast = std::int_fast64_t ;
249-
using u8_fast = std::uint_fast8_t ;
250-
using u16_fast = std::uint_fast16_t ;
251-
using u32_fast = std::uint_fast32_t ;
252-
using u64_fast = std::uint_fast64_t ;
253-
254-
// Rarely, when really needed for space optimization: Smallest type with at least N bits
255-
using i8_small = std::int_least8_t ;
256-
using i16_small = std::int_least16_t ;
257-
using i32_small = std::int_least32_t ;
258-
using i64_small = std::int_least64_t ;
259-
using u8_small = std::uint_least8_t ;
260-
using u16_small = std::uint_least16_t;
261-
using u32_small = std::uint_least32_t;
262-
using u64_small = std::uint_least64_t;
263-
264244
// Discouraged: Variable precision names
265245
// short
266246
using ushort = unsigned short;
@@ -564,7 +544,7 @@ class out {
564544
#endif
565545

566546
#define CPP2_UFCS(FUNCNAME,PARAM1,...) \
567-
[](auto&& obj, auto&& ...params) CPP2_FORCE_INLINE { \
547+
[](auto&& obj, auto&& ...params) CPP2_FORCE_INLINE -> decltype(auto) { \
568548
if constexpr (requires{ std::forward<decltype(obj)>(obj).FUNCNAME(std::forward<decltype(params)>(params)...); }) { \
569549
return std::forward<decltype(obj)>(obj).FUNCNAME(std::forward<decltype(params)>(params)...); \
570550
} else { \
@@ -573,7 +553,7 @@ class out {
573553
}(PARAM1, __VA_ARGS__)
574554

575555
#define CPP2_UFCS_0(FUNCNAME,PARAM1) \
576-
[](auto&& obj) CPP2_FORCE_INLINE { \
556+
[](auto&& obj) CPP2_FORCE_INLINE -> decltype(auto) { \
577557
if constexpr (requires{ std::forward<decltype(obj)>(obj).FUNCNAME(); }) { \
578558
return std::forward<decltype(obj)>(obj).FUNCNAME(); \
579559
} else { \
@@ -584,7 +564,7 @@ class out {
584564
#define CPP2_UFCS_REMPARENS(...) __VA_ARGS__
585565

586566
#define CPP2_UFCS_TEMPLATE(FUNCNAME,TEMPARGS,PARAM1,...) \
587-
[](auto&& obj, auto&& ...params) CPP2_FORCE_INLINE { \
567+
[](auto&& obj, auto&& ...params) CPP2_FORCE_INLINE -> decltype(auto) { \
588568
if constexpr (requires{ std::forward<decltype(obj)>(obj).template FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (std::forward<decltype(params)>(params)...); }) { \
589569
return std::forward<decltype(obj)>(obj).template FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (std::forward<decltype(params)>(params)...); \
590570
} else { \
@@ -593,7 +573,7 @@ class out {
593573
}(PARAM1, __VA_ARGS__)
594574

595575
#define CPP2_UFCS_TEMPLATE_0(FUNCNAME,TEMPARGS,PARAM1) \
596-
[](auto&& obj) CPP2_FORCE_INLINE { \
576+
[](auto&& obj) CPP2_FORCE_INLINE -> decltype(auto) { \
597577
if constexpr (requires{ std::forward<decltype(obj)>(obj).template FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (); }) { \
598578
return std::forward<decltype(obj)>(obj).template FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (); \
599579
} else { \

0 commit comments

Comments
 (0)