1 #ifndef DataFormats_Common_View_h 2 #define DataFormats_Common_View_h 22 #include "boost/iterator/indirect_iterator.hpp" 46 std::unique_ptr<ViewBase>
clone()
const;
52 virtual std::unique_ptr<ViewBase>
doClone()
const = 0;
76 typedef std::vector<T const*>
seq_t;
86 typedef boost::indirect_iterator<typename seq_t::const_iterator>
const_iterator;
102 View(std::vector<void const*>
const& pointers,
117 const_iterator
begin()
const;
118 const_iterator
end()
const;
120 const_reverse_iterator rbegin()
const;
121 const_reverse_iterator rend()
const;
123 size_type
size()
const;
124 size_type max_size()
const;
126 const_reference at(size_type
pos)
const;
130 std::vector<Ptr<value_type> >
const& ptrs()
const;
132 const_reference front()
const;
133 const_reference back()
const;
144 std::unique_ptr<ViewBase>
doClone()
const override;
150 template<
typename T>
bool operator< (View<T>
const&,
View<T> const&);
151 template<
typename T>
bool operator<=(View<T>
const&,
View<T> const&);
177 assert(numElements == helpers.size());
179 items_.reserve(numElements);
180 vPtrs_.reserve(numElements);
182 void const*
p = pointers[
i];
183 auto const&
h = helpers[
i];
184 items_.push_back(static_cast<pointer>(p));
186 vPtrs_.push_back(
Ptr<T>(
h.first, static_cast<T const*>(p),
h.second));
187 }
else if(getter !=
nullptr) {
188 vPtrs_.push_back(
Ptr<T>(
h.first,
h.second, getter));
190 vPtrs_.push_back(
Ptr<T>(
h.first,
nullptr,
h.second));
204 items_.swap(other.
items_);
205 vPtrs_.swap(other.
vPtrs_);
212 return items_.capacity();
219 return items_.begin();
240 return items_.
rend();
247 return items_.size();
261 return items_.empty();
268 return *items_.
at(pos);
286 return RefToBase<T>(std::unique_ptr<reftobase::BaseHolder<T>>{
288 std::unique_ptr<reftobase::RefHolder<edm::Ptr<T>>>{
304 std::vector<Ptr<T> >
const&
314 return *items_.
front();
321 return *items_.
back();
335 std::unique_ptr<ViewBase>
337 return std::unique_ptr<ViewBase>{
new View(*
this)};
354 lhs.size() == rhs.size() &&
355 std::equal(lhs.begin(), lhs.end(), rhs.begin());
362 return !(lhs == rhs);
368 operator<(View<T>
const& lhs,
View<T> const& rhs) {
369 return std::lexicographical_compare(lhs.begin(), lhs.end(),
370 rhs.begin(), rhs.end());
376 operator<=(View<T>
const& lhs,
View<T> const& rhs) {
const_reverse_iterator rbegin() const
const_reference back() const
void swap(View< T > &lhs, View< T > &rhs)
std::vector< T const * > seq_t
size_type max_size() const
seq_t::difference_type difference_type
virtual std::unique_ptr< ViewBase > doClone() const =0
bool equal(const T &first, const T &second)
bool operator>=(View< T > const &, View< T > const &)
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
std::vector< Ptr< value_type > > vPtrs_
std::unique_ptr< ViewBase > clone() const
bool operator>(View< T > const &, View< T > const &)
T operator[](int i) const
const_reverse_iterator rend() const
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
ViewBase & operator=(ViewBase const &)
bool operator!=(View< T > const &, View< T > const &)
boost::indirect_iterator< typename seq_t::const_reverse_iterator > const_reverse_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
bool operator==(View< T > const &, View< T > const &)
const_reference at(size_type pos) const
const_reference front() const
T first(std::pair< T, U > const &p)
T const & const_reference
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector