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
Show 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
...
...
@@ -38,14 +38,11 @@ namespace std {
using format_parse_context = basic_format_parse_context<char>;
using wformat_parse_context = basic_format_parse_context<wchar_t>;
template<class O, class charT> FMT_REQUIRES(OutputIterator<O, const charT&>)
class basic_format_context;
template<class Out, class charT> class basic_format_context;
using format_context = basic_format_context<
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<char>>,
char>;
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<char>>, char>;
using wformat_context = basic_format_context<
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<wchar_t>>,
wchar_t>;
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<wchar_t>>, wchar_t>;
template<class T, class charT = char> struct formatter {
formatter() = delete;
...
...
@@ -63,8 +60,8 @@ namespace std {
using format_args = basic_format_args<format_context>;
using wformat_args = basic_format_args<wformat_context>;
template<class O, class charT>
using format_args_t = basic_format_args<basic_format_context<O, charT>>;
template<class O
ut
, class charT>
using format_args_t = basic_format_args<basic_format_context<O
ut
, charT>>;
template<class Context = format_context, class... Args>
format_arg_store<Context, Args...>
...
...
@@ -82,27 +79,27 @@ namespace std {
string vformat(string_view fmt, format_args args);
wstring vformat(wstring_view fmt, wformat_args args);
template<
FMT_CONCEPT(OutputIterator<const char&>) O
, class... Args>
O
format_to(O
out, string_view fmt, const Args&... args);
template<
FMT_CONCEPT(OutputIterator<const wchar_t&>) O
, class... Args>
O
format_to(O
out, wstring_view fmt, const Args&... args);
template<
class Out
, class... Args>
O
ut format_to(Out
out, string_view fmt, const Args&... args);
template<
class Out
, class... Args>
O
ut format_to(Out
out, wstring_view fmt, const Args&... args);
template<
FMT_CONCEPT(OutputIterator<const char&>) O
>
O
vformat_to(O out, string_view fmt, format_args_t<O
, char> args);
template<
FMT_CONCEPT(OutputIterator<const wchar_t&>) O
>
O
vformat_to(O out, wstring_view fmt, format_args_t<O
, wchar_t> args);
template<
class Out
>
O
ut vformat_to(Out out, string_view fmt, format_args_t<Out
, char> args);
template<
class Out
>
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 {
O out;
iter_difference_t<O> size;
O
ut
out;
iter_difference_t<O
ut
> size;
};
template<
FMT_CONCEPT(OutputIterator<const char&>) O
, class... Args>
format_to_n_result<O
> format_to_n(O out, iter_difference_t<O
> n,
template<
class Out
, class... Args>
format_to_n_result<O
ut> format_to_n(Out out, iter_difference_t<Out
> n,
string_view fmt, const Args&... args);
template<
FMT_CONCEPT(OutputIterator<const wchar_t&>) O
, class... Args>
format_to_n_result<O
> format_to_n(O out, iter_difference_t<O
> n,
template<
class Out
, class... Args>
format_to_n_result<O
ut> format_to_n(Out out, iter_difference_t<Out
> n,
wstring_view fmt, const Args&... args);
template<class... Args>
...
...
@@ -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; }
}
namespace std {
namespace detail {
template <typename T>
constexpr bool is_standard_integer_v =
std::is_same_v<T, signed char> ||
...
...
@@ -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 long int>;
template <typename T, typename Char> struct formatter;
}
}
// http://fmtlib.net/Text%20Formatting.html#format.arg
namespace std {
template<class Context>
...
...
@@ -269,10 +272,11 @@ namespace std {
std::is_same_v<I, bool> ||
std::is_same_v<I, char_type> ||
(std::is_same_v<I, char> && std::is_same_v<char_type, wchar_t>) ||
is_standard_integer_v<I> ||
is_standard_unsigned_integer_v<I>
detail::is_standard_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(double n) noexcept; // exposition only
explicit basic_format_arg(long double n) noexcept; // exposition only
...
...
@@ -290,10 +294,6 @@ namespace std {
template<class T, typename = std::enable_if_t<std::is_same_v<T, void>>>
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>
// friend auto std::visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg);
...
...
@@ -301,6 +301,8 @@ namespace std {
friend format_arg_store<Ctx, Args...>
make_format_args(const Args&... args); // exposition only
template <typename T, typename Char> friend struct detail::formatter;
public:
basic_format_arg() noexcept;
...
...
@@ -314,19 +316,21 @@ basic_format_arg<Context>::basic_format_arg() noexcept {}
template<class Context>
template<FMT_CONCEPT(Integral) I, typename>
/* explicit */ basic_format_arg<Context>::basic_format_arg(
I
n) noexcept {
if (std::is_same_v<I, bool> || std::is_same_v<I, char_type>)
/* explicit */ basic_format_arg<Context>::basic_format_arg(
const I&
n) noexcept {
if
constexpr
(std::is_same_v<I, bool> || std::is_same_v<I, char_type>)
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);
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);
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);
else if
(
is_standard_integer_v<I>)
else if
constexpr (detail::
is_standard_integer_v<I>)
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);
else if constexpr (is_default_constructible_v<typename Context::template formatter_type<I>>)
value = handle(n);
}
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
: 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>
/* explicit */ basic_format_arg<Context>::operator bool() const noexcept {
return !holds_alternative<monostate>(value);
...
...
@@ -387,6 +386,8 @@ namespace std {
template<class T> explicit handle(const T& val) noexcept; // exposition only
friend class basic_format_arg<Context>;
public:
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