1 #ifndef DataFormats_Common_PtrVector_h 2 #define DataFormats_Common_PtrVector_h 28 #include <type_traits> 53 class PtrVectorItr :
public std::iterator <std::random_access_iterator_tag, Ptr<T> > {
66 return base_->fromItr(iter_);
70 return base_->fromItr(iter_+n);
80 iterator &
operator+=(difference_type
n) {iter_ +=
n;
return *
this;}
81 iterator &
operator-=(difference_type
n) {iter_ -=
n;
return *
this;}
83 iterator
operator++(
int) {iterator it(*
this); ++iter_;
return it;}
84 iterator
operator--(
int) {iterator it(*
this); --iter_;
return it;}
85 iterator
operator+(difference_type
n)
const {iterator it(*
this); it.
iter_+=
n;
return it;}
86 iterator
operator-(difference_type
n)
const {iterator it(*
this); it.
iter_-=
n;
return it;}
88 difference_type
operator-(iterator
const& rhs)
const {
return this->iter_ - rhs.
iter_;}
98 std::vector<void const*>::const_iterator
iter_;
102 template <
typename T>
118 template <
typename U>
126 return this->makePtr<Ptr<T> >(iIndex);
130 return const_iterator(this->void_begin(),
134 const_iterator
end()
const {
135 return const_iterator(this->void_end(),
141 this->push_back_base(iPtr.
refCore(),
143 iPtr.
hasProductCache() ? iPtr.operator->() :
static_cast<void const*
>(
nullptr));
150 this->push_back_base(iPtr.
refCore(),
152 iPtr.
hasProductCache() ? iPtr.operator->() :
static_cast<void const*
>(
nullptr));
165 void fillView(std::vector<void const*>& pointers,
174 std::type_info const& typeInfo()
const override {
return typeid(
T);}
177 Ptr<T> fromItr(std::vector<void const*>::const_iterator
const& iItr)
const {
178 return this->makePtr<Ptr<T> >(iItr);
183 template <
typename T>
187 pointers.reserve(this->
size());
190 T const* address = ref.
isNull() ?
nullptr : &*ref;
191 pointers.push_back(address);
196 template <
typename T>
199 std::vector<void const*>& pointers,
204 template <
typename T>
210 template <
typename T>
Ptr< T > fromItr(std::vector< void const * >::const_iterator const &iItr) const
iterator operator+(difference_type n) const
std::vector< void const * >::const_iterator iter_
difference_type operator-(iterator const &rhs) const
void swap(PtrVector &other)
void push_back(Ptr< T > const &iPtr)
PtrVectorItr< T > const_iterator
bool operator<=(iterator const &rhs) const
void swap(PtrVectorBase &other)
swap
PtrVectorItr(std::vector< void const * >::const_iterator const &iItr, PtrVector< T > const *iBase)
PtrVector< T > const * base_
iterator & operator-=(difference_type n)
#define CMS_CLASS_VERSION(_version_)
PtrHolder< T > operator->() const
void swap(Association< C > &lhs, Association< C > &rhs)
const_iterator begin() const
void fillView(std::vector< void const * > &pointers, FillViewHelperVector &helpers) const
Container::value_type value_type
iterator operator-(difference_type n) const
std::iterator< std::random_access_iterator_tag, Ptr< T > >::difference_type difference_type
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, FillViewHelperVector &helpers)
bool isNull() const
Checks for null.
RefCore const & refCore() const
const_iterator end() const
PtrVector(ProductID const &iId)
iterator & operator+=(difference_type n)
Ptr< T > const operator*() const
void push_back(Ptr< U > const &iPtr)
PtrVector & operator=(PtrVector const &rhs)
PtrHolder(Ptr< T > const &iPtr)
bool hasProductCache() const
PtrVectorItr< T > iterator
Ptr< T > const & operator*() const
ProductID id() const
Accessor for product ID.
PtrVectorItr< T > iterator
bool operator>(iterator const &rhs) const
Ptr< T > const * operator->() const
Ptr< T > operator[](unsigned long const iIndex) const
bool operator<(iterator const &rhs) const
Ptr< T > const operator[](difference_type n) const
bool operator>=(iterator const &rhs) const
bool operator==(iterator const &rhs) const
std::vector< std::pair< edm::ProductID, unsigned long > > FillViewHelperVector
PtrVector(PtrVector< T > const &iOther)
PtrVector(PtrVector< U > const &iOther)
bool operator!=(iterator const &rhs) const