WPILibC++ 2024.3.2
iterator_traits.h
Go to the documentation of this file.
1// __ _____ _____ _____
2// __| | __| | | | JSON for Modern C++
3// | | |__ | | | | | | version 3.11.2
4// |_____|_____|_____|_|___| https://github.com/nlohmann/json
5//
6// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
7// SPDX-License-Identifier: MIT
8
9#pragma once
10
11#include <iterator> // random_access_iterator_tag
12
16
18namespace detail
19{
20
21template<typename It, typename = void>
23
24template<typename It>
26 It,
27 void_t<typename It::difference_type, typename It::value_type, typename It::pointer,
28 typename It::reference, typename It::iterator_category >>
29{
30 using difference_type = typename It::difference_type;
31 using value_type = typename It::value_type;
32 using pointer = typename It::pointer;
33 using reference = typename It::reference;
34 using iterator_category = typename It::iterator_category;
35};
36
37// This is required as some compilers implement std::iterator_traits in a way that
38// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341.
39template<typename T, typename = void>
41{
42};
43
44template<typename T>
45struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
47{
48};
49
50template<typename T>
52{
53 using iterator_category = std::random_access_iterator_tag;
54 using value_type = T;
55 using difference_type = ptrdiff_t;
56 using pointer = T*;
57 using reference = T&;
58};
59
60} // namespace detail
#define WPI_JSON_NAMESPACE_END
Definition: abi_macros.h:59
#define WPI_JSON_NAMESPACE_BEGIN
Definition: abi_macros.h:53
detail namespace with internal helper functions
Definition: xchar.h:20
void void_t
Definition: core.h:1510
typename std::enable_if< B, T >::type enable_if_t
Definition: cpp_future.h:38
Definition: array.h:89
std::random_access_iterator_tag iterator_category
Definition: iterator_traits.h:53
Definition: iterator_traits.h:41
Definition: iterator_traits.h:22