Commit e3f20d3e authored by Victor Zverovich's avatar Victor Zverovich

Remove gcc 4.4 workaround and use proper alias templates (#940)

parent b4388123
......@@ -3340,25 +3340,17 @@ inline typename buffer_context<Char>::iterator format_to(
}
template <typename OutputIt, typename Char = char>
// using format_context_t = basic_format_context<OutputIt, Char>;
struct format_context_t {
typedef basic_format_context<OutputIt, Char> type;
};
using format_context_t = basic_format_context<OutputIt, Char>;
template <typename OutputIt, typename Char = char>
// using format_args_t = basic_format_args<format_context_t<OutputIt, Char>>;
struct format_args_t {
typedef basic_format_args<typename format_context_t<OutputIt, Char>::type>
type;
};
using format_args_t = basic_format_args<format_context_t<OutputIt, Char>>;
template <typename S, typename OutputIt, typename... Args,
FMT_ENABLE_IF(
internal::is_output_iterator<OutputIt>::value &&
!internal::is_contiguous_back_insert_iterator<OutputIt>::value)>
inline OutputIt vformat_to(
OutputIt out, const S& format_str,
typename format_args_t<OutputIt, char_t<S>>::type args) {
inline OutputIt vformat_to(OutputIt out, const S& format_str,
format_args_t<OutputIt, char_t<S>> args) {
typedef internal::output_range<OutputIt, char_t<S>> range;
return vformat_to<arg_formatter<range>>(range(out),
to_string_view(format_str), args);
......@@ -3382,7 +3374,7 @@ inline OutputIt format_to(OutputIt out, const S& format_str,
internal::is_string<S>::value,
"");
internal::check_format_string<Args...>(format_str);
typedef typename format_context_t<OutputIt, char_t<S>>::type context;
typedef format_context_t<OutputIt, char_t<S>> context;
format_arg_store<context, Args...> as{args...};
return vformat_to(out, to_string_view(format_str),
basic_format_args<context>(as));
......@@ -3396,28 +3388,24 @@ template <typename OutputIt> struct format_to_n_result {
};
template <typename OutputIt, typename Char = typename OutputIt::value_type>
struct format_to_n_context
: format_context_t<fmt::internal::truncating_iterator<OutputIt>, Char> {};
using format_to_n_context =
format_context_t<fmt::internal::truncating_iterator<OutputIt>, Char>;
template <typename OutputIt, typename Char = typename OutputIt::value_type>
struct format_to_n_args {
typedef basic_format_args<typename format_to_n_context<OutputIt, Char>::type>
type;
};
using format_to_n_args = basic_format_args<format_to_n_context<OutputIt, Char>>;
template <typename OutputIt, typename Char, typename... Args>
inline format_arg_store<typename format_to_n_context<OutputIt, Char>::type,
Args...>
inline format_arg_store<format_to_n_context<OutputIt, Char>, Args...>
make_format_to_n_args(const Args&... args) {
return format_arg_store<typename format_to_n_context<OutputIt, Char>::type,
Args...>(args...);
return format_arg_store<format_to_n_context<OutputIt, Char>, Args...>(
args...);
}
template <typename OutputIt, typename Char, typename... Args,
FMT_ENABLE_IF(internal::is_output_iterator<OutputIt>::value)>
inline format_to_n_result<OutputIt> vformat_to_n(
OutputIt out, std::size_t n, basic_string_view<Char> format_str,
typename format_to_n_args<OutputIt, Char>::type args) {
format_to_n_args<OutputIt, Char> args) {
typedef internal::truncating_iterator<OutputIt> It;
auto it = vformat_to(It(out, n), format_str, args);
return {it.base(), it.count()};
......@@ -3438,10 +3426,9 @@ inline format_to_n_result<OutputIt> format_to_n(OutputIt out, std::size_t n,
const Args&... args) {
internal::check_format_string<Args...>(format_str);
using Char = char_t<S>;
format_arg_store<typename format_to_n_context<OutputIt, Char>::type, Args...>
as(args...);
format_arg_store<format_to_n_context<OutputIt, Char>, Args...> as(args...);
return vformat_to_n(out, n, to_string_view(format_str),
typename format_to_n_args<OutputIt, Char>::type(as));
format_to_n_args<OutputIt, Char>(as));
}
template <typename Char>
......
......@@ -54,7 +54,7 @@ template <typename S, typename OutputIt, typename... Args,
internal::is_output_iterator<OutputIt>::value, char_t<S>>>
inline OutputIt vformat_to(OutputIt out, const std::locale& loc,
const S& format_str,
typename format_args_t<OutputIt, Char>::type args) {
format_args_t<OutputIt, Char> args) {
using range = internal::output_range<OutputIt, Char>;
return vformat_to<arg_formatter<range>>(
range(out), to_string_view(format_str), args, internal::locale_ref(loc));
......@@ -66,7 +66,7 @@ template <typename OutputIt, typename S, typename... Args,
inline OutputIt format_to(OutputIt out, const std::locale& loc,
const S& format_str, const Args&... args) {
internal::check_format_string<Args...>(format_str);
using context = typename format_context_t<OutputIt, char_t<S>>::type;
using context = format_context_t<OutputIt, char_t<S>>;
format_arg_store<context, Args...> as{args...};
return vformat_to(out, loc, to_string_view(format_str),
basic_format_args<context>(as));
......
......@@ -127,7 +127,7 @@ void vprint(std::basic_ostream<Char>& os, basic_string_view<Char> format_str,
*/
template <typename S, typename... Args,
typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
inline void print(std::basic_ostream<Char>& os, const S& format_str,
void print(std::basic_ostream<Char>& os, const S& format_str,
const Args&... args) {
vprint(os, to_string_view(format_str),
{internal::make_args_checked(format_str, args...)});
......
......@@ -232,7 +232,7 @@ class prepared_format {
template <typename OutputIt>
inline OutputIt format_to(OutputIt out, const Args&... args) const {
typedef typename format_context_t<OutputIt, char_type>::type context;
typedef format_context_t<OutputIt, char_type> context;
typedef output_range<OutputIt, char_type> range;
format_arg_store<context, Args...> as(args...);
return this->vformat_to(range(out), basic_format_args<context>(as));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment