util-test -> core-test and minor cleanup
This commit is contained in:
parent
ffe414cad1
commit
8db14efa84
@ -9,6 +9,7 @@
|
|||||||
#define FMT_CORE_H_
|
#define FMT_CORE_H_
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstdio> // std::FILE
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -204,6 +205,16 @@ namespace internal {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
typename std::add_rvalue_reference<T>::type declval() FMT_NOEXCEPT;
|
typename std::add_rvalue_reference<T>::type declval() FMT_NOEXCEPT;
|
||||||
|
|
||||||
|
template <typename>
|
||||||
|
struct result_of;
|
||||||
|
|
||||||
|
template <typename F, typename... Args>
|
||||||
|
struct result_of<F(Args...)> {
|
||||||
|
// A workaround for gcc 4.4 that doesn't allow F to be a reference.
|
||||||
|
typedef typename std::result_of<
|
||||||
|
typename std::remove_reference<F>::type(Args...)>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
// Casts nonnegative integer to unsigned.
|
// Casts nonnegative integer to unsigned.
|
||||||
template <typename Int>
|
template <typename Int>
|
||||||
FMT_CONSTEXPR typename std::make_unsigned<Int>::type to_unsigned(Int value) {
|
FMT_CONSTEXPR typename std::make_unsigned<Int>::type to_unsigned(Int value) {
|
||||||
@ -692,16 +703,6 @@ enum { max_packed_args = 15 };
|
|||||||
|
|
||||||
template <typename Context>
|
template <typename Context>
|
||||||
class arg_map;
|
class arg_map;
|
||||||
|
|
||||||
template <typename>
|
|
||||||
struct result_of;
|
|
||||||
|
|
||||||
template <typename F, typename... Args>
|
|
||||||
struct result_of<F(Args...)> {
|
|
||||||
// A workaround for gcc 4.4 that doesn't allow F to be a reference.
|
|
||||||
typedef typename std::result_of<
|
|
||||||
typename std::remove_reference<F>::type(Args...)>::type type;
|
|
||||||
};
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
// A formatting argument. It is a trivially copyable/constructible type to
|
// A formatting argument. It is a trivially copyable/constructible type to
|
||||||
@ -1320,10 +1321,9 @@ typename std::enable_if<
|
|||||||
is_contiguous<Container>::value, std::back_insert_iterator<Container>>::type
|
is_contiguous<Container>::value, std::back_insert_iterator<Container>>::type
|
||||||
vformat_to(std::back_insert_iterator<Container> out,
|
vformat_to(std::back_insert_iterator<Container> out,
|
||||||
string_view format_str, format_args args) {
|
string_view format_str, format_args args) {
|
||||||
auto& container = internal::get_container(out);
|
internal::container_buffer<Container> buf(internal::get_container(out));
|
||||||
internal::container_buffer<Container> buf(container);
|
|
||||||
vformat_to(buf, format_str, args);
|
vformat_to(buf, format_str, args);
|
||||||
return std::back_inserter(container);
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Container>
|
template <typename Container>
|
||||||
@ -1331,10 +1331,9 @@ typename std::enable_if<
|
|||||||
is_contiguous<Container>::value, std::back_insert_iterator<Container>>::type
|
is_contiguous<Container>::value, std::back_insert_iterator<Container>>::type
|
||||||
vformat_to(std::back_insert_iterator<Container> out,
|
vformat_to(std::back_insert_iterator<Container> out,
|
||||||
wstring_view format_str, wformat_args args) {
|
wstring_view format_str, wformat_args args) {
|
||||||
auto& container = internal::get_container(out);
|
internal::container_buffer<Container> buf(internal::get_container(out));
|
||||||
internal::container_buffer<Container> buf(container);
|
|
||||||
vformat_to(buf, format_str, args);
|
vformat_to(buf, format_str, args);
|
||||||
return std::back_inserter(container);
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string vformat(string_view format_str, format_args args);
|
std::string vformat(string_view format_str, format_args args);
|
||||||
|
@ -85,13 +85,13 @@ function(add_fmt_test name)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_fmt_test(assert-test)
|
add_fmt_test(assert-test)
|
||||||
|
add_fmt_test(core-test mock-allocator.h)
|
||||||
add_fmt_test(gtest-extra-test)
|
add_fmt_test(gtest-extra-test)
|
||||||
add_fmt_test(format-test)
|
add_fmt_test(format-test)
|
||||||
add_fmt_test(format-impl-test)
|
add_fmt_test(format-impl-test)
|
||||||
add_fmt_test(ostream-test)
|
add_fmt_test(ostream-test)
|
||||||
add_fmt_test(printf-test)
|
add_fmt_test(printf-test)
|
||||||
add_fmt_test(time-test)
|
add_fmt_test(time-test)
|
||||||
add_fmt_test(util-test mock-allocator.h)
|
|
||||||
add_fmt_test(custom-formatter-test)
|
add_fmt_test(custom-formatter-test)
|
||||||
add_fmt_test(ranges-test)
|
add_fmt_test(ranges-test)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user