mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Merge branch 'main' into 2027
This commit is contained in:
@@ -33,7 +33,7 @@ class circular_buffer {
|
||||
|
||||
class iterator {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using pointer = T*;
|
||||
@@ -51,6 +51,15 @@ class circular_buffer {
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
constexpr iterator& operator--() {
|
||||
--m_index;
|
||||
return *this;
|
||||
}
|
||||
constexpr iterator operator--(int) {
|
||||
iterator retval = *this;
|
||||
--(*this);
|
||||
return retval;
|
||||
}
|
||||
constexpr bool operator==(const iterator&) const = default;
|
||||
constexpr reference operator*() { return (*m_buffer)[m_index]; }
|
||||
|
||||
@@ -61,7 +70,7 @@ class circular_buffer {
|
||||
|
||||
class const_iterator {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using pointer = T*;
|
||||
@@ -79,6 +88,15 @@ class circular_buffer {
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
constexpr const_iterator& operator--() {
|
||||
--m_index;
|
||||
return *this;
|
||||
}
|
||||
constexpr const_iterator operator--(int) {
|
||||
const_iterator retval = *this;
|
||||
--(*this);
|
||||
return retval;
|
||||
}
|
||||
constexpr bool operator==(const const_iterator&) const = default;
|
||||
constexpr const_reference operator*() const { return (*m_buffer)[m_index]; }
|
||||
|
||||
@@ -87,21 +105,83 @@ class circular_buffer {
|
||||
size_t m_index;
|
||||
};
|
||||
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
/**
|
||||
* Returns begin iterator.
|
||||
*/
|
||||
constexpr iterator begin() { return iterator(this, 0); }
|
||||
|
||||
/**
|
||||
* Returns end iterator.
|
||||
*/
|
||||
constexpr iterator end() {
|
||||
return iterator(this, ::wpi::circular_buffer<T>::size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns const begin iterator.
|
||||
*/
|
||||
constexpr const_iterator begin() const { return const_iterator(this, 0); }
|
||||
|
||||
/**
|
||||
* Returns const end iterator.
|
||||
*/
|
||||
constexpr const_iterator end() const {
|
||||
return const_iterator(this, ::wpi::circular_buffer<T>::size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns const begin iterator.
|
||||
*/
|
||||
constexpr const_iterator cbegin() const { return const_iterator(this, 0); }
|
||||
|
||||
/**
|
||||
* Returns const end iterator.
|
||||
*/
|
||||
constexpr const_iterator cend() const {
|
||||
return const_iterator(this, ::wpi::circular_buffer<T>::size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns reverse begin iterator.
|
||||
*/
|
||||
constexpr reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
|
||||
/**
|
||||
* Returns reverse end iterator.
|
||||
*/
|
||||
constexpr reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
|
||||
/**
|
||||
* Returns const reverse begin iterator.
|
||||
*/
|
||||
constexpr const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns const reverse end iterator.
|
||||
*/
|
||||
constexpr const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns const reverse begin iterator.
|
||||
*/
|
||||
constexpr const_reverse_iterator crbegin() const {
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns const reverse end iterator.
|
||||
*/
|
||||
constexpr const_reverse_iterator crend() const {
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of elements in buffer
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@ class static_circular_buffer {
|
||||
|
||||
class iterator {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using pointer = T*;
|
||||
@@ -42,6 +42,15 @@ class static_circular_buffer {
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
constexpr iterator& operator--() {
|
||||
--m_index;
|
||||
return *this;
|
||||
}
|
||||
constexpr iterator operator--(int) {
|
||||
iterator retval = *this;
|
||||
--(*this);
|
||||
return retval;
|
||||
}
|
||||
constexpr bool operator==(const iterator&) const = default;
|
||||
constexpr reference operator*() { return (*m_buffer)[m_index]; }
|
||||
|
||||
@@ -52,7 +61,7 @@ class static_circular_buffer {
|
||||
|
||||
class const_iterator {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using pointer = T*;
|
||||
@@ -70,6 +79,15 @@ class static_circular_buffer {
|
||||
++(*this);
|
||||
return retval;
|
||||
}
|
||||
constexpr const_iterator& operator--() {
|
||||
--m_index;
|
||||
return *this;
|
||||
}
|
||||
constexpr const_iterator operator--(int) {
|
||||
const_iterator retval = *this;
|
||||
--(*this);
|
||||
return retval;
|
||||
}
|
||||
constexpr bool operator==(const const_iterator&) const = default;
|
||||
constexpr const_reference operator*() const { return (*m_buffer)[m_index]; }
|
||||
|
||||
@@ -78,6 +96,9 @@ class static_circular_buffer {
|
||||
size_t m_index;
|
||||
};
|
||||
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
|
||||
/**
|
||||
* Returns begin iterator.
|
||||
*/
|
||||
@@ -91,29 +112,67 @@ class static_circular_buffer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns begin iterator.
|
||||
* Returns const begin iterator.
|
||||
*/
|
||||
constexpr const_iterator begin() const { return const_iterator(this, 0); }
|
||||
|
||||
/**
|
||||
* Returns end iterator.
|
||||
* Returns const end iterator.
|
||||
*/
|
||||
constexpr const_iterator end() const {
|
||||
return const_iterator(this, ::wpi::static_circular_buffer<T, N>::size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns begin iterator.
|
||||
* Returns const begin iterator.
|
||||
*/
|
||||
constexpr const_iterator cbegin() const { return const_iterator(this, 0); }
|
||||
|
||||
/**
|
||||
* Returns end iterator.
|
||||
* Returns const end iterator.
|
||||
*/
|
||||
constexpr const_iterator cend() const {
|
||||
return const_iterator(this, ::wpi::static_circular_buffer<T, N>::size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns reverse begin iterator.
|
||||
*/
|
||||
constexpr reverse_iterator rbegin() { return reverse_iterator(end()); }
|
||||
|
||||
/**
|
||||
* Returns reverse end iterator.
|
||||
*/
|
||||
constexpr reverse_iterator rend() { return reverse_iterator(begin()); }
|
||||
|
||||
/**
|
||||
* Returns const reverse begin iterator.
|
||||
*/
|
||||
constexpr const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns const reverse end iterator.
|
||||
*/
|
||||
constexpr const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns const reverse begin iterator.
|
||||
*/
|
||||
constexpr const_reverse_iterator crbegin() const {
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns const reverse end iterator.
|
||||
*/
|
||||
constexpr const_reverse_iterator crend() const {
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of elements in buffer
|
||||
*/
|
||||
|
||||
@@ -161,7 +161,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
using serializer = ::wpi::detail::serializer<basic_json>;
|
||||
|
||||
using value_t = detail::value_t;
|
||||
/// JSON Pointer, see @ref wpi::json_pointer
|
||||
/// JSON Pointer, see @ref json_pointer
|
||||
using json_pointer = ::wpi::json_pointer<StringType>;
|
||||
template<typename T, typename SFINAE>
|
||||
using json_serializer = JSONSerializer<T, SFINAE>;
|
||||
@@ -173,7 +173,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
|
||||
|
||||
using input_format_t = detail::input_format_t;
|
||||
/// SAX interface type, see @ref wpi::json_sax
|
||||
/// SAX interface type, see wpi::json_sax
|
||||
using json_sax_t = json_sax<basic_json>;
|
||||
|
||||
////////////////
|
||||
@@ -1606,13 +1606,6 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
|
||||
@throw what @ref json_serializer<ValueType> `from_json()` method throws
|
||||
|
||||
@liveexample{The example below shows several conversions from JSON values
|
||||
to other types. There a few things to note: (1) Floating-point numbers can
|
||||
be converted to integers\, (2) A JSON array can be converted to a standard
|
||||
`std::vector<short>`\, (3) A JSON object can be converted to C++
|
||||
associative containers such as `std::unordered_map<std::string\,
|
||||
json>`.,get__ValueType_const}
|
||||
|
||||
@since version 2.1.0
|
||||
*/
|
||||
template < typename ValueType,
|
||||
@@ -1678,7 +1671,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
|
||||
@return a copy of *this, converted into @a BasicJsonType
|
||||
|
||||
@complexity Depending on the implementation of the called `from_json()`
|
||||
Complexity: Depending on the implementation of the called `from_json()`
|
||||
method.
|
||||
|
||||
@since version 3.2.0
|
||||
@@ -1702,7 +1695,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
|
||||
@return a copy of *this
|
||||
|
||||
@complexity Constant.
|
||||
Complexity: Constant.
|
||||
|
||||
@since version 2.1.0
|
||||
*/
|
||||
@@ -1786,12 +1779,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
@return pointer to the internally stored JSON value if the requested
|
||||
pointer type @a PointerType fits to the JSON value; `nullptr` otherwise
|
||||
|
||||
@complexity Constant.
|
||||
|
||||
@liveexample{The example below shows how pointers to internal values of a
|
||||
JSON value can be requested. Note that no type conversions are made and a
|
||||
`nullptr` is returned if the value and the requested pointer type does not
|
||||
match.,get__PointerType}
|
||||
Complexity: Constant.
|
||||
|
||||
@sa see @ref get_ptr() for explicit pointer-member access
|
||||
|
||||
@@ -1883,14 +1871,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
to the JSON value type (e.g., the JSON value is of type boolean, but a
|
||||
string is requested); see example below
|
||||
|
||||
@complexity Linear in the size of the JSON value.
|
||||
|
||||
@liveexample{The example below shows several conversions from JSON values
|
||||
to other types. There a few things to note: (1) Floating-point numbers can
|
||||
be converted to integers\, (2) A JSON array can be converted to a standard
|
||||
`std::vector<short>`\, (3) A JSON object can be converted to C++
|
||||
associative containers such as `std::unordered_map<std::string\,
|
||||
json>`.,operator__ValueType}
|
||||
Complexity: Linear in the size of the JSON value.
|
||||
|
||||
@since version 1.0.0
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user