mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-25 15:21:54 +00:00
Make advance_to a noop for back_insert_iterator
This commit is contained in:
parent
50bad7d62d
commit
57ddc77ce7
@ -1202,7 +1202,27 @@ FMT_CONSTEXPR_DECL FMT_INLINE auto visit_format_arg(
|
|||||||
return vis(monostate());
|
return vis(monostate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks whether T is a container with contiguous storage.
|
||||||
|
template <typename T> struct is_contiguous : std::false_type {};
|
||||||
|
template <typename Char>
|
||||||
|
struct is_contiguous<std::basic_string<Char>> : std::true_type {};
|
||||||
|
template <typename Char>
|
||||||
|
struct is_contiguous<detail::buffer<Char>> : std::true_type {};
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
template <typename OutputIt>
|
||||||
|
struct is_back_insert_iterator : std::false_type {};
|
||||||
|
template <typename Container>
|
||||||
|
struct is_back_insert_iterator<std::back_insert_iterator<Container>>
|
||||||
|
: std::true_type {};
|
||||||
|
|
||||||
|
template <typename OutputIt>
|
||||||
|
struct is_contiguous_back_insert_iterator : std::false_type {};
|
||||||
|
template <typename Container>
|
||||||
|
struct is_contiguous_back_insert_iterator<std::back_insert_iterator<Container>>
|
||||||
|
: is_contiguous<Container> {};
|
||||||
|
|
||||||
// A type-erased reference to an std::locale to avoid heavy <locale> include.
|
// A type-erased reference to an std::locale to avoid heavy <locale> include.
|
||||||
class locale_ref {
|
class locale_ref {
|
||||||
private:
|
private:
|
||||||
@ -1329,7 +1349,9 @@ template <typename OutputIt, typename Char> class basic_format_context {
|
|||||||
iterator out() { return out_; }
|
iterator out() { return out_; }
|
||||||
|
|
||||||
// Advances the begin iterator to ``it``.
|
// Advances the begin iterator to ``it``.
|
||||||
void advance_to(iterator it) { out_ = it; }
|
void advance_to(iterator it) {
|
||||||
|
if (!detail::is_back_insert_iterator<iterator>()) out_ = it;
|
||||||
|
}
|
||||||
|
|
||||||
detail::locale_ref locale() { return loc_; }
|
detail::locale_ref locale() { return loc_; }
|
||||||
};
|
};
|
||||||
@ -1715,22 +1737,8 @@ struct wformat_args : basic_format_args<wformat_context> {
|
|||||||
using basic_format_args::basic_format_args;
|
using basic_format_args::basic_format_args;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Container> struct is_contiguous : std::false_type {};
|
|
||||||
|
|
||||||
template <typename Char>
|
|
||||||
struct is_contiguous<std::basic_string<Char>> : std::true_type {};
|
|
||||||
|
|
||||||
template <typename Char>
|
|
||||||
struct is_contiguous<detail::buffer<Char>> : std::true_type {};
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template <typename OutputIt>
|
|
||||||
struct is_contiguous_back_insert_iterator : std::false_type {};
|
|
||||||
template <typename Container>
|
|
||||||
struct is_contiguous_back_insert_iterator<std::back_insert_iterator<Container>>
|
|
||||||
: is_contiguous<Container> {};
|
|
||||||
|
|
||||||
// Reports a compile-time error if S is not a valid format string.
|
// Reports a compile-time error if S is not a valid format string.
|
||||||
template <typename..., typename S, FMT_ENABLE_IF(!is_compile_string<S>::value)>
|
template <typename..., typename S, FMT_ENABLE_IF(!is_compile_string<S>::value)>
|
||||||
FMT_INLINE void check_format_string(const S&) {
|
FMT_INLINE void check_format_string(const S&) {
|
||||||
|
Loading…
Reference in New Issue
Block a user