Improve comments
This commit is contained in:
parent
f889e52a15
commit
b9ce56d936
@ -1222,6 +1222,8 @@ using long_type = conditional_t<long_short, int, long long>;
|
|||||||
using ulong_type = conditional_t<long_short, unsigned, unsigned long long>;
|
using ulong_type = conditional_t<long_short, unsigned, unsigned long long>;
|
||||||
|
|
||||||
// Maps formatting arguments to core types.
|
// Maps formatting arguments to core types.
|
||||||
|
// arg_mapper reports errors by returning unformattable instead of using
|
||||||
|
// static_assert because it's used in the is_formattable trait.
|
||||||
template <typename Context> struct arg_mapper {
|
template <typename Context> struct arg_mapper {
|
||||||
using char_type = typename Context::char_type;
|
using char_type = typename Context::char_type;
|
||||||
|
|
||||||
@ -1325,10 +1327,6 @@ template <typename Context> struct arg_mapper {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
FMT_CONSTEXPR auto map(T)
|
FMT_CONSTEXPR auto map(T)
|
||||||
-> enable_if_t<std::is_pointer<T>::value, unformattable_pointer> {
|
-> enable_if_t<std::is_pointer<T>::value, unformattable_pointer> {
|
||||||
// Formatting of arbitrary pointers is disallowed. If you want to output
|
|
||||||
// a pointer cast it to "void *" or "const void *". In particular, this
|
|
||||||
// forbids formatting of "[const] volatile char *" which is printed as bool
|
|
||||||
// by iostreams.
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1593,10 +1591,14 @@ template <bool IS_PACKED, typename Context, type, typename T,
|
|||||||
FMT_ENABLE_IF(IS_PACKED)>
|
FMT_ENABLE_IF(IS_PACKED)>
|
||||||
FMT_CONSTEXPR FMT_INLINE auto make_arg(T&& val) -> value<Context> {
|
FMT_CONSTEXPR FMT_INLINE auto make_arg(T&& val) -> value<Context> {
|
||||||
const auto& arg = arg_mapper<Context>().map(std::forward<T>(val));
|
const auto& arg = arg_mapper<Context>().map(std::forward<T>(val));
|
||||||
|
|
||||||
|
// Formatting of arbitrary pointers is disallowed. If you want to output
|
||||||
|
// a pointer cast it to "void *" or "const void *". In particular, this
|
||||||
|
// forbids formatting of "[const] volatile char *" which is printed as bool
|
||||||
|
// by iostreams.
|
||||||
constexpr bool void_ptr =
|
constexpr bool void_ptr =
|
||||||
!std::is_same<decltype(arg), const unformattable_pointer&>::value;
|
!std::is_same<decltype(arg), const unformattable_pointer&>::value;
|
||||||
static_assert(void_ptr,
|
static_assert(void_ptr, "Formatting of non-void pointers is disallowed.");
|
||||||
"Formatting of non-void pointers is disallowed.");
|
|
||||||
constexpr bool formattable =
|
constexpr bool formattable =
|
||||||
!std::is_same<decltype(arg), const unformattable&>::value;
|
!std::is_same<decltype(arg), const unformattable&>::value;
|
||||||
static_assert(
|
static_assert(
|
||||||
|
Loading…
Reference in New Issue
Block a user