Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
09e2ac5e
Commit
09e2ac5e
authored
Apr 10, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update <format>
parent
df4ea0c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
47 deletions
+48
-47
include/format
include/format
+48
-47
No files found.
include/format
View file @
09e2ac5e
...
@@ -37,20 +37,17 @@ namespace std {
...
@@ -37,20 +37,17 @@ namespace std {
template<class charT> class basic_format_parse_context;
template<class charT> class basic_format_parse_context;
using format_parse_context = basic_format_parse_context<char>;
using format_parse_context = basic_format_parse_context<char>;
using wformat_parse_context = basic_format_parse_context<wchar_t>;
using wformat_parse_context = basic_format_parse_context<wchar_t>;
template<class O, class charT> FMT_REQUIRES(OutputIterator<O, const charT&>)
template<class Out, class charT> class basic_format_context;
class basic_format_context;
using format_context = basic_format_context<
using format_context = basic_format_context<
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<char>>,
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<char>>, char>;
char>;
using wformat_context = basic_format_context<
using wformat_context = basic_format_context<
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<wchar_t>>,
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<wchar_t>>, wchar_t>;
wchar_t>;
template<class T, class charT = char> struct formatter {
template<class T, class charT = char> struct formatter {
formatter() = delete;
formatter() = delete;
};
};
// [format.arguments], arguments
// [format.arguments], arguments
template<class Context> class basic_format_arg;
template<class Context> class basic_format_arg;
...
@@ -63,8 +60,8 @@ namespace std {
...
@@ -63,8 +60,8 @@ namespace std {
using format_args = basic_format_args<format_context>;
using format_args = basic_format_args<format_context>;
using wformat_args = basic_format_args<wformat_context>;
using wformat_args = basic_format_args<wformat_context>;
template<class O, class charT>
template<class O
ut
, class charT>
using format_args_t = basic_format_args<basic_format_context<O, charT>>;
using format_args_t = basic_format_args<basic_format_context<O
ut
, charT>>;
template<class Context = format_context, class... Args>
template<class Context = format_context, class... Args>
format_arg_store<Context, Args...>
format_arg_store<Context, Args...>
...
@@ -82,28 +79,28 @@ namespace std {
...
@@ -82,28 +79,28 @@ namespace std {
string vformat(string_view fmt, format_args args);
string vformat(string_view fmt, format_args args);
wstring vformat(wstring_view fmt, wformat_args args);
wstring vformat(wstring_view fmt, wformat_args args);
template<
FMT_CONCEPT(OutputIterator<const char&>) O
, class... Args>
template<
class Out
, class... Args>
O
format_to(O
out, string_view fmt, const Args&... args);
O
ut format_to(Out
out, string_view fmt, const Args&... args);
template<
FMT_CONCEPT(OutputIterator<const wchar_t&>) O
, class... Args>
template<
class Out
, class... Args>
O
format_to(O
out, wstring_view fmt, const Args&... args);
O
ut format_to(Out
out, wstring_view fmt, const Args&... args);
template<
FMT_CONCEPT(OutputIterator<const char&>) O
>
template<
class Out
>
O
vformat_to(O out, string_view fmt, format_args_t<O
, char> args);
O
ut vformat_to(Out out, string_view fmt, format_args_t<Out
, char> args);
template<
FMT_CONCEPT(OutputIterator<const wchar_t&>) O
>
template<
class Out
>
O
vformat_to(O out, wstring_view fmt, format_args_t<O
, wchar_t> args);
O
ut vformat_to(Out out, wstring_view fmt, format_args_t<Out
, wchar_t> args);
template<class O>
template<class O
ut
>
struct format_to_n_result {
struct format_to_n_result {
O out;
O
ut
out;
iter_difference_t<O> size;
iter_difference_t<O
ut
> size;
};
};
template<
FMT_CONCEPT(OutputIterator<const char&>) O
, class... Args>
template<
class Out
, class... Args>
format_to_n_result<O
> format_to_n(O out, iter_difference_t<O
> n,
format_to_n_result<O
ut> format_to_n(Out out, iter_difference_t<Out
> n,
string_view fmt, const Args&... args);
string_view fmt, const Args&... args);
template<
FMT_CONCEPT(OutputIterator<const wchar_t&>) O
, class... Args>
template<
class Out
, class... Args>
format_to_n_result<O
> format_to_n(O out, iter_difference_t<O
> n,
format_to_n_result<O
ut> format_to_n(Out out, iter_difference_t<Out
> n,
wstring_view fmt, const Args&... args);
wstring_view fmt, const Args&... args);
template<class... Args>
template<class... Args>
size_t formatted_size(string_view fmt, const Args&... args);
size_t formatted_size(string_view fmt, const Args&... args);
...
@@ -229,6 +226,8 @@ template<class O, class charT>
...
@@ -229,6 +226,8 @@ template<class O, class charT>
void basic_format_context<O, charT>::advance_to(typename basic_format_context<O, charT>::iterator it) { out_ = it; }
void basic_format_context<O, charT>::advance_to(typename basic_format_context<O, charT>::iterator it) { out_ = it; }
}
}
namespace std {
namespace detail {
template <typename T>
template <typename T>
constexpr bool is_standard_integer_v =
constexpr bool is_standard_integer_v =
std::is_same_v<T, signed char> ||
std::is_same_v<T, signed char> ||
...
@@ -245,6 +244,10 @@ constexpr bool is_standard_unsigned_integer_v =
...
@@ -245,6 +244,10 @@ constexpr bool is_standard_unsigned_integer_v =
std::is_same_v<T, unsigned long int> ||
std::is_same_v<T, unsigned long int> ||
std::is_same_v<T, unsigned long long int>;
std::is_same_v<T, unsigned long long int>;
template <typename T, typename Char> struct formatter;
}
}
// http://fmtlib.net/Text%20Formatting.html#format.arg
// http://fmtlib.net/Text%20Formatting.html#format.arg
namespace std {
namespace std {
template<class Context>
template<class Context>
...
@@ -269,10 +272,11 @@ namespace std {
...
@@ -269,10 +272,11 @@ namespace std {
std::is_same_v<I, bool> ||
std::is_same_v<I, bool> ||
std::is_same_v<I, char_type> ||
std::is_same_v<I, char_type> ||
(std::is_same_v<I, char> && std::is_same_v<char_type, wchar_t>) ||
(std::is_same_v<I, char> && std::is_same_v<char_type, wchar_t>) ||
is_standard_integer_v<I> ||
detail::is_standard_integer_v<I> ||
is_standard_unsigned_integer_v<I>
detail::is_standard_unsigned_integer_v<I> ||
is_default_constructible_v<typename Context::template formatter_type<I>>
>>
>>
explicit basic_format_arg(
I
n) noexcept; // exposition only
explicit basic_format_arg(
const I&
n) noexcept; // exposition only
explicit basic_format_arg(float n) noexcept; // exposition only
explicit basic_format_arg(float n) noexcept; // exposition only
explicit basic_format_arg(double n) noexcept; // exposition only
explicit basic_format_arg(double n) noexcept; // exposition only
explicit basic_format_arg(long double n) noexcept; // exposition only
explicit basic_format_arg(long double n) noexcept; // exposition only
...
@@ -290,10 +294,6 @@ namespace std {
...
@@ -290,10 +294,6 @@ namespace std {
template<class T, typename = std::enable_if_t<std::is_same_v<T, void>>>
template<class T, typename = std::enable_if_t<std::is_same_v<T, void>>>
explicit basic_format_arg(const T* p) noexcept; // exposition only
explicit basic_format_arg(const T* p) noexcept; // exposition only
template<class T, typename = std::enable_if_t<
!Integral<T> && is_default_constructible_v<typename Context::template formatter_type<T>>>>
explicit basic_format_arg(const T& v) noexcept; // exposition only
//template<class Visitor>
//template<class Visitor>
// friend auto std::visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg);
// friend auto std::visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg);
...
@@ -301,6 +301,8 @@ namespace std {
...
@@ -301,6 +301,8 @@ namespace std {
friend format_arg_store<Ctx, Args...>
friend format_arg_store<Ctx, Args...>
make_format_args(const Args&... args); // exposition only
make_format_args(const Args&... args); // exposition only
template <typename T, typename Char> friend struct detail::formatter;
public:
public:
basic_format_arg() noexcept;
basic_format_arg() noexcept;
...
@@ -314,19 +316,21 @@ basic_format_arg<Context>::basic_format_arg() noexcept {}
...
@@ -314,19 +316,21 @@ basic_format_arg<Context>::basic_format_arg() noexcept {}
template<class Context>
template<class Context>
template<FMT_CONCEPT(Integral) I, typename>
template<FMT_CONCEPT(Integral) I, typename>
/* explicit */ basic_format_arg<Context>::basic_format_arg(
I
n) noexcept {
/* explicit */ basic_format_arg<Context>::basic_format_arg(
const I&
n) noexcept {
if (std::is_same_v<I, bool> || std::is_same_v<I, char_type>)
if
constexpr
(std::is_same_v<I, bool> || std::is_same_v<I, char_type>)
value = n;
value = n;
else if (std::is_same_v<I, char> && std::is_same_v<char_type, wchar_t>)
else if
constexpr
(std::is_same_v<I, char> && std::is_same_v<char_type, wchar_t>)
value = static_cast<wchar_t>(n);
value = static_cast<wchar_t>(n);
else if
(
is_standard_integer_v<I> && sizeof(I) <= sizeof(int))
else if
constexpr (detail::
is_standard_integer_v<I> && sizeof(I) <= sizeof(int))
value = static_cast<int>(n);
value = static_cast<int>(n);
else if
(
is_standard_unsigned_integer_v<I> && sizeof(I) <= sizeof(unsigned))
else if
constexpr (detail::
is_standard_unsigned_integer_v<I> && sizeof(I) <= sizeof(unsigned))
value = static_cast<unsigned>(n);
value = static_cast<unsigned>(n);
else if
(
is_standard_integer_v<I>)
else if
constexpr (detail::
is_standard_integer_v<I>)
value = static_cast<long long int>(n);
value = static_cast<long long int>(n);
else if
(
is_standard_unsigned_integer_v<I>)
else if
constexpr (detail::
is_standard_unsigned_integer_v<I>)
value = static_cast<unsigned long long int>(n);
value = static_cast<unsigned long long int>(n);
else if constexpr (is_default_constructible_v<typename Context::template formatter_type<I>>)
value = handle(n);
}
}
template<class Context>
template<class Context>
...
@@ -367,11 +371,6 @@ template<class Context>
...
@@ -367,11 +371,6 @@ template<class Context>
template<class T, typename> /* explicit */ basic_format_arg<Context>::basic_format_arg(const T* p) noexcept
template<class T, typename> /* explicit */ basic_format_arg<Context>::basic_format_arg(const T* p) noexcept
: value(p) {}
: value(p) {}
template<class Context>
template<class T, typename>
/* explicit */ basic_format_arg<Context>::basic_format_arg(const T& v) noexcept
: value(handle(v)) {}
template<class Context>
template<class Context>
/* explicit */ basic_format_arg<Context>::operator bool() const noexcept {
/* explicit */ basic_format_arg<Context>::operator bool() const noexcept {
return !holds_alternative<monostate>(value);
return !holds_alternative<monostate>(value);
...
@@ -387,6 +386,8 @@ namespace std {
...
@@ -387,6 +386,8 @@ namespace std {
template<class T> explicit handle(const T& val) noexcept; // exposition only
template<class T> explicit handle(const T& val) noexcept; // exposition only
friend class basic_format_arg<Context>;
public:
public:
void format(basic_format_parse_context<char_type>&, Context& ctx) const;
void format(basic_format_parse_context<char_type>&, Context& ctx) const;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment