WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
ranges.h File Reference
#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.

Classes

class  detail::is_map< T >
 
class  detail::is_set< T >
 
struct  detail::has_member_fn_begin_end_t< T, Enable >
 
struct  detail::has_member_fn_begin_end_t< T, void_t< decltype(*std::declval< T >().begin()), decltype(std::declval< T >().end())> >
 
struct  detail::has_const_begin_end< T, Enable >
 
struct  detail::has_mutable_begin_end< T, Enable >
 
struct  detail::has_const_begin_end< T, void_t< decltype(*detail::range_begin(std::declval< const remove_cvref_t< T > & >())), decltype(detail::range_end(std::declval< const remove_cvref_t< T > & >()))> >
 
struct  detail::has_mutable_begin_end< T, void_t< decltype(*detail::range_begin(std::declval< T & >())), decltype(detail::range_end(std::declval< T & >())), int > >
 
struct  detail::is_range_< T, _ >
 
struct  detail::is_range_< T, void >
 
class  detail::is_tuple_like_< T >
 
struct  detail::integer_sequence< T, Ints >
 
struct  detail::make_integer_sequence< T, N, Ns >
 
struct  detail::make_integer_sequence< T, 0, Ns... >
 
class  detail::is_tuple_formattable_< T, C, bool >
 
class  detail::is_tuple_formattable_< T, C, true >
 
struct  detail::range_format_kind_< T >
 
struct  detail::parse_empty_specs< Char >
 
struct  detail::format_tuple_element< FormatContext >
 
struct  is_tuple_like< T >
 
struct  is_tuple_formattable< T, C >
 
struct  formatter< Tuple, Char, enable_if_t< fmt::is_tuple_like< Tuple >::value &&fmt::is_tuple_formattable< Tuple, Char >::value > >
 
struct  is_range< T, Char >
 
struct  detail::is_formattable_delayed< R, Char >
 
struct  conjunction<... >
 
struct  conjunction< P >
 
struct  conjunction< P1, Pn... >
 
struct  range_formatter< T, Char, enable_if_t< conjunction< std::is_same< T, remove_cvref_t< T > >, is_formattable< T, Char > >::value > >
 
struct  range_format_kind< T, Char, Enable >
 
struct  formatter< R, Char, enable_if_t< conjunction< bool_constant< range_format_kind< R, Char >::value !=range_format::disabled &&range_format_kind< R, Char >::value !=range_format::map &&range_format_kind< R, Char >::value !=range_format::string &&range_format_kind< R, Char >::value !=range_format::debug_string >, detail::is_formattable_delayed< R, Char > >::value > >
 
struct  formatter< R, Char, enable_if_t< range_format_kind< R, Char >::value==range_format::map > >
 
struct  formatter< R, Char, enable_if_t< range_format_kind< R, Char >::value==range_format::string||range_format_kind< R, Char >::value==range_format::debug_string > >
 
struct  join_view< It, Sentinel, Char >
 
struct  formatter< join_view< It, Sentinel, Char >, Char >
 
struct  tuple_join_view< Char, Tuple >
 
struct  formatter< tuple_join_view< Char, Tuple >, Char, enable_if_t< is_tuple_like< Tuple >::value > >
 
class  detail::is_container_adaptor_like< T >
 
struct  detail::all< Container >
 
struct  formatter< T, Char, enable_if_t< conjunction< detail::is_container_adaptor_like< T >, bool_constant< range_format_kind< T, Char >::value==range_format::disabled > >::value > >
 

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.
 

Macro Definition Documentation

◆ FMT_TUPLE_JOIN_SPECIFIERS

#define FMT_TUPLE_JOIN_SPECIFIERS   0

Enumeration Type Documentation

◆ range_format

enum class range_format
strong
Enumerator
disabled 
map 
set 
sequence 
string 
debug_string 

Function Documentation

◆ join() [1/4]

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.

Example:

auto t = std::tuple<int, char>{1, 'a'};
fmt::print("{}", fmt::join(t, ", "));
// Output: 1, a

◆ join() [2/4]

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.

◆ join() [3/4]

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.

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

◆ join() [4/4]

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.

Example:

fmt::print("{}", fmt::join({1, 2, 3}, ", "));
// Output: "1, 2, 3"