ArrayRef
#include <gccs/ArrayRef.hpp>
-
template<class T>
class ArrayRef A non-owning, immutable view on some contiguous data. It only holds a pointer and the size of the data.
Public Types
Public Functions
-
constexpr ArrayRef() = default
-
template<class U>
inline constexpr ArrayRef(std::initializer_list<U> ilist) Constructs a view from an initializer_list This is necessary to resolve brace-enclosed initializer lists This function only participates in overload resolution if ilist.begin() is convertible to T*.
-
template<class U>
inline constexpr ArrayRef(U &t) Constructs a view to a container’s underlying array.
This overload only participates in overload resolution if the container declares
data()
andsize()
member functions or is a C-style array.
-
template<class U>
inline constexpr ArrayRef(const U &t) Constructs a view to a container’s underlying array.
This overload only partiipates in overload resolution if the container declares
data()
andsize()
member functions or is a C-style array, and the pointer returned by eitherdata()
or array decay is implicitly convertible to T* (i.e. we allow non-const to const conversion).
-
inline constexpr bool empty() const noexcept
Checks whether the container is empty.
-
inline T &front() noexcept
Access the first element.
ArrayRef must not be empty before calling this function.
-
inline const T &front() const noexcept
Access the first element.
ArrayRef must not be empty before calling this function.
-
inline T &back() noexcept
Access the last element.
ArrayRef must not be empty before calling this function.
-
inline const T &back() const noexcept
Access the last element.
ArrayRef must not be empty before calling this function.
-
inline const_iterator cbegin() const noexcept
Returns a const iterator to the beginning.
-
inline const_iterator cend() const noexcept
Returns a const iterator to the end.
-
constexpr ArrayRef() = default
-
template<class T>
class ArrayRef<const T> Specialization for
T const
.Subclassed by poplar::ArrayRef< T >
Public Types
Public Functions
-
inline constexpr ArrayRef()
Constructs a view that is empty.
-
inline constexpr ArrayRef(const T *p, std::size_t size)
Constructs a view to a buffer given its starting address and size.
-
template<class U, class Alloc>
inline ArrayRef(const std::vector<U, Alloc> &v) Construct a view to a vector storage.
If vector elements are pointers this constructor only participates in overload resolution if we can convert the vector elements to T
-
template<std::size_t N>
inline constexpr ArrayRef(const std::array<T, N> &a) Construct a view from a std::array.
-
template<std::size_t N>
inline constexpr ArrayRef(const T (&p)[N]) Construct a view from a C-style array.
-
inline constexpr ArrayRef(const std::initializer_list<T> &list)
Constructs a view from an initializer_list.
-
template<class U>
inline constexpr ArrayRef(const ArrayRef<U> &a) Construct a view to an ArrayRef storage.
This constructor only participates in overload resolution if we can convert the ArrayRef elements to T
-
inline constexpr bool empty() const
Checks whether the container is empty.
-
inline const T &front() const
Access the first element.
ArrayRef must not be empty before calling this function.
-
inline const T &back() const
Access the last element.
ArrayRef must not be empty before calling this function.
-
inline const_iterator begin() const
Returns a const iterator to the beginning.
-
inline const_iterator cbegin() const
Returns a const iterator to the end.
-
inline const_iterator end() const
Returns a const iterator to the end.
-
inline const_iterator cend() const
Returns a const iterator to the end.
-
inline constexpr ArrayRef()
The following API is deprecated and may be removed in future.
#include <poplar/ArrayRef.hpp>
-
template<class T>
class ArrayRef : public gccs::ArrayRef<const T> - Deprecated:
Use gccs::ArrayRef<T>