24 #ifndef PXR_BASE_TF_SPAN_H
25 #define PXR_BASE_TF_SPAN_H
35 #include <type_traits>
102 TfSpan() noexcept = default;
108 : _data(ptr), _size(
count)
123 template <
class Container>
125 typename std::enable_if<
130 : _data(cont.
data()), _size(cont.
size())
138 template <
class Container>
140 typename std::enable_if<
144 : _data(cont.
data()), _size(cont.
size())
156 bool empty() const noexcept {
return _size == 0; }
239 template <
typename Container>
248 template <
typename Container>
257 #endif // PXR_BASE_TF_SPAN_H
const_reverse_iterator crend() const noexcept
Returns a const reverse iterator to the end of the span.
TfSpan() noexcept=default
const_iterator cend() const noexcept
Returns a const iterator to the end of the span.
TfSpan(Container &cont, typename std::enable_if< !std::is_const< element_type >::value &&std::is_same< typename Container::value_type, value_type >::value, Container >::type *=0)
index_type size() const noexcept
Return the total number of elements in the span.
bool empty() const noexcept
Returns true if this span contains no elements, false otherwise.
std::ptrdiff_t difference_type
GLsizei const GLfloat * value
reference operator[](index_type idx) const
const_iterator cbegin() const noexcept
Returns a cons iterator to the start of the span.
TfSpan(pointer first, pointer last)
Construct a span over the range [first, last).
#define TF_DEV_AXIOM(cond)
std::reverse_iterator< const_iterator > const_reverse_iterator
TfSpan(const Container &cont, typename std::enable_if< std::is_same< typename Container::value_type, value_type >::value, Container >::type *=0)
TfSpan< T > last(size_t count) const
Return a subspan consisting of the last count elements of this span.
TfSpan< T > first(size_t count) const
Return a subspan consisting of the first count elements of this span.
TfSpan< T > subspan(difference_type offset, difference_type count=-1) const
typename std::remove_cv< T >::type value_type
std::reverse_iterator< iterator > reverse_iterator
iterator end() const noexcept
Returns a non-const iterator to the end of the span.
reverse_iterator rbegin() const noexcept
Returns a non-const reverse iterator the start of the span.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
TfSpan< typename Container::value_type > TfMakeSpan(Container &cont)
Helper for constructing a non-const TfSpan from a container.
TfSpan< const typename Container::value_type > TfMakeConstSpan(const Container &cont)
Helper for constructing a const TfSpan from a container.
#define PXR_NAMESPACE_CLOSE_SCOPE
pointer data() const noexcept
Return a pointer to the first element of the span.
iterator begin() const noexcept
Returns a non-const iterator the start of the span.
reference back() const
Return a reference to the last element in the span.
reverse_iterator rend() const noexcept
Returns a non-const reverse iterator to the end of the span.
reference front() const
Return a reference to the first element in the span.
const_reverse_iterator crbegin() const noexcept
Returns a cons reverse iterator to the start of the span.