WPILibC++ 2025.2.1
|
#include <initializer_list>
#include <iterator>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include "format.h"
Go to the source code of this file.
Namespaces | |
namespace | detail |
detail namespace with internal helper functions | |
namespace | detail::tuple |
Macros | |
#define | FMT_TUPLE_JOIN_SPECIFIERS 0 |
Typedefs | |
template<size_t... N> | |
using | detail::index_sequence = integer_sequence<size_t, N...> |
template<size_t N> | |
using | detail::make_index_sequence = make_integer_sequence<size_t, N> |
template<typename T > | |
using | detail::tuple_index_sequence = make_index_sequence<std::tuple_size<T>::value> |
template<typename Char , typename... T> | |
using | detail::tuple::result_t = std::tuple<formatter<remove_cvref_t<T>, Char>...> |
template<typename Range > | |
using | detail::range_reference_type |
template<typename Range > | |
using | detail::uncvref_type = remove_cvref_t<range_reference_type<Range>> |
template<range_format K> | |
using | detail::range_format_constant = std::integral_constant<range_format, K> |
template<typename Char , typename Element > | |
using | detail::range_formatter_type = formatter<remove_cvref_t<Element>, Char> |
template<typename R > | |
using | detail::maybe_const_range |
Enumerations | |
enum class | range_format { disabled , map , set , sequence , string , debug_string } |
Functions | |
template<typename T , std::size_t N> | |
auto | detail::range_begin (const T(&arr)[N]) -> const T * |
template<typename T , std::size_t N> | |
auto | detail::range_end (const T(&arr)[N]) -> const T * |
template<typename T > | |
auto | detail::range_begin (T &&rng) -> decltype(static_cast< T && >(rng).begin()) |
template<typename T > | |
auto | detail::range_end (T &&rng) -> decltype(static_cast< T && >(rng).end()) |
template<typename Tuple , typename F , size_t... Is> | |
FMT_CONSTEXPR void | detail::for_each (index_sequence< Is... >, Tuple &&t, F &&f) |
template<typename Tuple , typename F > | |
FMT_CONSTEXPR void | detail::for_each (Tuple &&t, F &&f) |
template<typename Tuple1 , typename Tuple2 , typename F , size_t... Is> | |
void | detail::for_each2 (index_sequence< Is... >, Tuple1 &&t1, Tuple2 &&t2, F &&f) |
template<typename Tuple1 , typename Tuple2 , typename F > | |
void | detail::for_each2 (Tuple1 &&t1, Tuple2 &&t2, F &&f) |
template<typename Tuple , typename Char , std::size_t... Is> | |
auto | detail::tuple::get_formatters (index_sequence< Is... >) -> result_t< Char, decltype(get< Is >(std::declval< Tuple >()))... > |
template<typename Formatter > | |
FMT_CONSTEXPR auto | detail::maybe_set_debug_format (Formatter &f, bool set) -> decltype(f.set_debug_format(set)) |
template<typename Formatter > | |
FMT_CONSTEXPR void | detail::maybe_set_debug_format (Formatter &,...) |
template<typename It , typename Sentinel > | |
FMT_BEGIN_EXPORT auto | join (It begin, Sentinel end, string_view sep) -> join_view< It, Sentinel > |
Returns a view that formats the iterator range [begin, end) with elements separated by sep . | |
template<typename Range , FMT_ENABLE_IF(!is_tuple_like< Range >::value) > | |
auto | join (Range &&r, string_view sep) -> join_view< decltype(detail::range_begin(r)), decltype(detail::range_end(r))> |
Returns a view that formats range with elements separated by sep . | |
template<typename Tuple , FMT_ENABLE_IF(is_tuple_like< Tuple >::value) > | |
FMT_CONSTEXPR auto | join (const Tuple &tuple, string_view sep) -> tuple_join_view< char, Tuple > |
Returns an object that formats std::tuple with elements separated by sep . | |
template<typename T > | |
auto | join (std::initializer_list< T > list, string_view sep) -> join_view< const T *, const T * > |
Returns an object that formats std::initializer_list with elements separated by sep . | |
#define FMT_TUPLE_JOIN_SPECIFIERS 0 |
|
strong |
FMT_CONSTEXPR auto join | ( | const Tuple & | tuple, |
string_view | sep ) -> tuple_join_view<char, Tuple> |
Returns an object that formats std::tuple
with elements separated by sep
.
Example:
auto t = std::tuple<int, char>{1, 'a'}; fmt::print("{}", fmt::join(t, ", ")); // Output: 1, a
FMT_BEGIN_EXPORT auto join | ( | It | begin, |
Sentinel | end, | ||
string_view | sep ) -> join_view<It, Sentinel> |
Returns a view that formats the iterator range [begin, end)
with elements separated by sep
.
auto join | ( | Range && | r, |
string_view | sep ) -> join_view<decltype(detail::range_begin(r)), decltype(detail::range_end(r))> |
Returns a view that formats range
with elements separated by sep
.
Example:
auto v = std::vector<int>{1, 2, 3}; fmt::print("{}", fmt::join(v, ", ")); // Output: 1, 2, 3
fmt::join
applies passed format specifiers to the range elements:
fmt::print("{:02}", fmt::join(v, ", ")); // Output: 01, 02, 03
auto join | ( | std::initializer_list< T > | list, |
string_view | sep ) -> join_view<const T*, const T*> |
Returns an object that formats std::initializer_list
with elements separated by sep
.
Example:
fmt::print("{}", fmt::join({1, 2, 3}, ", ")); // Output: "1, 2, 3"