mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-09 21:00:06 +00:00
Simplify iterator detection
This commit is contained in:
parent
3fe4641d3a
commit
1408f1824d
@ -474,24 +474,23 @@ FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detect {
|
namespace adl {
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
template <typename Container>
|
||||||
|
auto invoke_back_inserter()
|
||||||
|
-> decltype(back_inserter(std::declval<Container&>()));
|
||||||
|
} // namespace adl
|
||||||
|
|
||||||
template <typename It, typename Enable = std::true_type>
|
template <typename It, typename Enable = std::true_type>
|
||||||
struct is_back_insert_iterator : std::false_type {};
|
struct is_back_insert_iterator : std::false_type {};
|
||||||
|
|
||||||
template <typename It>
|
template <typename It>
|
||||||
struct is_back_insert_iterator<
|
struct is_back_insert_iterator<
|
||||||
It,
|
It, bool_constant<std::is_same<
|
||||||
bool_constant<std::is_same<
|
decltype(adl::invoke_back_inserter<typename It::container_type>()),
|
||||||
decltype(back_inserter(std::declval<typename It::container_type&>())),
|
|
||||||
It>::value>> : std::true_type {};
|
It>::value>> : std::true_type {};
|
||||||
|
|
||||||
} // namespace detect
|
|
||||||
|
|
||||||
using detect::is_back_insert_iterator;
|
|
||||||
|
|
||||||
// Extracts a reference to the container from *insert_iterator.
|
// Extracts a reference to the container from *insert_iterator.
|
||||||
template <typename OutputIt>
|
template <typename OutputIt>
|
||||||
inline auto get_container(OutputIt it) -> typename OutputIt::container_type& {
|
inline auto get_container(OutputIt it) -> typename OutputIt::container_type& {
|
||||||
@ -1185,10 +1184,8 @@ template <typename T> class basic_appender {
|
|||||||
using appender = basic_appender<char>;
|
using appender = basic_appender<char>;
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
namespace detect {
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_back_insert_iterator<basic_appender<T>> : std::true_type {};
|
struct is_back_insert_iterator<basic_appender<T>> : std::true_type {};
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, typename Enable = void>
|
template <typename T, typename Enable = void>
|
||||||
struct locking : std::true_type {};
|
struct locking : std::true_type {};
|
||||||
|
Loading…
Reference in New Issue
Block a user