25template <
typename T>
const T&
unwrap(
const T& v) {
return v; }
26template <
typename T>
const T&
unwrap(
const std::reference_wrapper<T>& v) {
27 return static_cast<const T&
>(v);
34 template <
typename =
void>
struct node {
35 virtual ~node() =
default;
36 std::unique_ptr<node<>> next;
39 template <
typename T>
struct typed_node : node<> {
42 template <
typename Arg>
45 template <
typename Char>
50 std::unique_ptr<node<>> head_;
53 template <
typename T,
typename Arg>
const T&
push(
const Arg&
arg) {
54 auto new_node = std::unique_ptr<typed_node<T>>(
new typed_node<T>(
arg));
56 new_node->next = std::move(head_);
57 head_ = std::move(new_node);
73template <
typename Context>
81 using char_type =
typename Context::char_type;
83 template <
typename T>
struct need_copy {
85 detail::mapped_type_constant<T, Context>::value;
89 std::is_same<T, basic_string_view<char_type>>
::value ||
90 std::is_same<T, detail::std_string_view<char_type>>
::value ||
91 (mapped_type != detail::type::cstring_type &&
92 mapped_type != detail::type::string_type &&
93 mapped_type != detail::type::custom_type))
99 std::is_convertible<T, std::basic_string<char_type>>
::value &&
101 std::basic_string<char_type>, T>;
104 std::vector<basic_format_arg<Context>> data_;
105 std::vector<detail::named_arg_info<char_type>> named_info_;
113 unsigned long long get_types()
const {
121 return named_info_.empty() ? data_.data() : data_.data() + 1;
124 template <
typename T>
void emplace_arg(
const T&
arg) {
125 data_.emplace_back(detail::make_arg<Context>(
arg));
128 template <
typename T>
129 void emplace_arg(
const detail::named_arg<char_type, T>&
arg) {
130 if (named_info_.empty()) {
131 constexpr const detail::named_arg_info<char_type>* zero_ptr{
nullptr};
132 data_.insert(data_.begin(), {zero_ptr, 0});
135 auto pop_one = [](std::vector<basic_format_arg<Context>>*
data) {
138 std::unique_ptr<std::vector<basic_format_arg<Context>>,
decltype(pop_one)>
139 guard{&data_, pop_one};
140 named_info_.push_back({
arg.name,
static_cast<int>(data_.size() - 2u)});
141 data_[0].value_.named_args = {named_info_.data(), named_info_.size()};
167 emplace_arg(dynamic_args_.
push<stored_type<T>>(
arg));
190 "objects of built-in types and string views are always copied");
191 emplace_arg(
arg.get());
199 template <
typename T>
201 const char_type* arg_name =
202 dynamic_args_.
push<std::basic_string<char_type>>(
arg.name).c_str();
224 void reserve(
size_t new_cap,
size_t new_cap_named) {
226 "Set of arguments includes set of named arguments");
227 data_.reserve(new_cap);
228 named_info_.reserve(new_cap_named);
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
Definition: ArrayCwiseUnaryOps.h:66
you may not use this file except in compliance with the License You may obtain a copy of the License at software distributed under the License is distributed on an AS IS WITHOUT WARRANTIES OR CONDITIONS OF ANY either express or implied See the License for the specific language governing permissions and limitations under the License LLVM Exceptions to the Apache License As an if
Definition: ThirdPartyNotices.txt:289
An implementation of std::basic_string_view for pre-C++17.
Definition: core.h:430
const T & push(const Arg &arg)
Definition: args.h:53
constexpr FMT_INLINE value()
Definition: core.h:1263
constexpr FMT_INLINE auto const_check(T value) -> T
Definition: core.h:356
#define FMT_ASSERT(condition, message)
Definition: core.h:369
@ has_named_args_bit
Definition: core.h:1537
#define FMT_GCC_VERSION
Definition: core.h:32
#define FMT_CONSTEXPR
Definition: core.h:106
type
Definition: core.h:575
#define FMT_BEGIN_NAMESPACE
Definition: core.h:214
typename std::conditional< B, T, F >::type conditional_t
Definition: core.h:300
@ is_unpacked_bit
Definition: core.h:1536
#define FMT_END_NAMESPACE
Definition: core.h:217
Definition: format-inl.h:32
const T & unwrap(const T &v)
Definition: args.h:25
Definition: BFloat16.h:88
Definition: format.h:1552