diff --git a/include/fmt/core.h b/include/fmt/core.h index acbddf1a..4820219d 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -861,7 +861,7 @@ class arg_map { if (it->name == name) return it->arg; } - return basic_format_arg(); + return {}; } }; @@ -899,9 +899,8 @@ class context_base { } public: - basic_parse_context &parse_context() { - return parse_context_; - } + basic_parse_context &parse_context() { return parse_context_; } + basic_format_args args() const { return args_; } internal::error_handler error_handler() { return parse_context_.error_handler(); @@ -915,8 +914,6 @@ class context_base { // Advances the begin iterator to ``it``. void advance_to(iterator it) { out_ = it; } - - basic_format_args args() const { return args_; } }; // Extracts a reference to the container from back_insert_iterator. @@ -1086,15 +1083,11 @@ const long long format_arg_store::TYPES = get_types(); */ template inline format_arg_store - make_format_args(const Args &... args) { - return format_arg_store(args...); -} + make_format_args(const Args &... args) { return {args...}; } template inline format_arg_store - make_format_args(const Args &... args) { - return format_arg_store(args...); -} + make_format_args(const Args &... args) { return {args...}; } /** Formatting arguments. */ template @@ -1240,12 +1233,12 @@ struct named_arg : named_arg_base { */ template inline internal::named_arg arg(string_view name, const T &arg) { - return internal::named_arg(name, arg); + return {name, arg}; } template inline internal::named_arg arg(wstring_view name, const T &arg) { - return internal::named_arg(name, arg); + return {name, arg}; } // This function template is deleted intentionally to disable nested named diff --git a/include/fmt/format.h b/include/fmt/format.h index 3d75065f..9f2a1d2f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -434,31 +434,26 @@ void basic_buffer::append(const U *begin, const U *end) { // A UTF-8 code unit type. struct char8_t { char value; - FMT_CONSTEXPR explicit operator bool() const FMT_NOEXCEPT { + FMT_CONSTEXPR FMT_EXPLICIT operator bool() const FMT_NOEXCEPT { return value != 0; } }; // A UTF-8 string view. class u8string_view : public basic_string_view { - private: - typedef basic_string_view base; - public: - using basic_string_view::basic_string_view; - using basic_string_view::char_type; + typedef char8_t char_type; - u8string_view(const char *s) - : base(reinterpret_cast(s)) {} - - u8string_view(const char *s, size_t count) FMT_NOEXCEPT - : base(reinterpret_cast(s), count) {} + u8string_view(const char *s): + basic_string_view(reinterpret_cast(s)) {} + u8string_view(const char *s, size_t count) FMT_NOEXCEPT: + basic_string_view(reinterpret_cast(s), count) {} }; #if FMT_USE_USER_DEFINED_LITERALS inline namespace literals { inline u8string_view operator"" _u(const char *s, std::size_t n) { - return u8string_view(s, n); + return {s, n}; } } #endif