File indexing completed on 2024-04-06 12:13:13
0001 #ifndef FWCore_Utilities_Span_h
0002 #define FWCore_Utilities_Span_h
0003
0004 #include <cstddef>
0005
0006 namespace edm {
0007
0008
0009
0010
0011
0012
0013
0014
0015 template <class T>
0016 class Span {
0017 public:
0018 Span(T begin, T end) : begin_(begin), end_(end) {}
0019
0020 T begin() const { return begin_; }
0021 T end() const { return end_; }
0022
0023 bool empty() const { return begin_ == end_; }
0024 auto size() const { return end_ - begin_; }
0025
0026 auto const& operator[](std::size_t idx) const { return *(begin_ + idx); }
0027
0028 auto const& front() const { return *begin_; }
0029 auto const& back() const { return *(end_ - 1); }
0030
0031 private:
0032 const T begin_;
0033 const T end_;
0034 };
0035 };
0036
0037 #endif