1 #ifndef canvas_Persistency_Common_PtrVector_h 2 #define canvas_Persistency_Common_PtrVector_h 15 #include <initializer_list> 24 void swap(PtrVector<T>&, PtrVector<T>&);
26 template <
typename Comp>
98 Ptr<T> const& operator[](
unsigned long const idx)
const;
108 template <
typename U>
110 template <
class InputIterator>
111 void assign(InputIterator first, InputIterator last);
112 template <
typename U>
113 void assign(std::initializer_list<
Ptr<U>> il);
114 template <
typename U>
116 template <
typename... Args>
117 void emplace_back(Args&&...
args);
119 template <
typename U>
121 template <
typename U>
123 template <
typename InputIterator>
137 template <
class Comp>
138 void sort(Comp comp);
147 void fill_from_offsets(
indices_t const& indices)
const override;
148 void zeroTransients()
override;
155 #include <functional> 157 #include <type_traits> 160 template <
typename T>
163 template <
typename T>
164 template <
typename U>
169 static_assert(std::is_base_of_v<T, U> || std::is_base_of_v<U, T>,
170 "PtrVector: incompatible types");
175 template <
typename T>
176 template <
typename U>
179 static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
180 std::is_base_of_v<U, T>,
181 "PtrVector: incompatible types");
182 ptrs_.reserve(il.size());
183 for (
auto&&
p : il) {
189 template <
typename T>
190 template <
typename U>
194 static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
195 std::is_base_of_v<U, T>,
196 "PtrVector: incompatible types");
201 template <
typename T>
202 template <
typename U>
206 static_assert(std::is_base_of_v<T, U> || std::is_base_of_v<U, T>,
207 "PtrVector: incompatible types");
208 PtrVectorBase::operator=(
other);
215 template <
typename T>
219 return ptrs_.begin();
222 template <
typename T>
226 return ptrs_.begin();
229 template <
typename T>
236 template <
typename T>
243 template <
typename T>
247 return ptrs_.rbegin();
250 template <
typename T>
254 return ptrs_.rbegin();
257 template <
typename T>
264 template <
typename T>
271 template <
typename T>
275 return ptrs_.cbegin();
278 template <
typename T>
285 template <
typename T>
289 return ptrs_.crbegin();
292 template <
typename T>
296 return ptrs_.crend();
300 template <
typename T>
307 template <
typename T>
311 return ptrs_.max_size();
314 template <
typename T>
321 template <
typename T>
325 return ptrs_.capacity();
328 template <
typename T>
332 return ptrs_.empty();
335 template <
typename T>
342 template <
typename T>
346 ptrs_.shrink_to_fit();
350 template <
typename T>
352 unsigned long const idx)
const 354 return *(
begin() + idx);
357 template <
typename T>
364 template <
typename T>
371 template <
typename T>
375 return ptrs_.front();
378 template <
typename T>
382 return ptrs_.front();
385 template <
typename T>
392 template <
typename T>
400 template <
typename T>
401 template <
typename U>
405 static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
406 std::is_base_of_v<U, T>,
407 "PtrVector: incompatible types");
413 template <
typename T>
414 template <
typename InputIterator>
421 ptrs_.assign(first, last);
424 template <
typename T>
425 template <
typename U>
429 assign(il.begin(), il.end());
432 template <
typename T>
433 template <
typename U>
438 static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
439 std::is_base_of_v<U, T>,
440 "PtrVector: incompatible types");
445 template <
typename T>
446 template <
typename... Args>
455 template <
typename T>
462 template <
typename T>
463 template <
typename U>
468 static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
469 std::is_base_of_v<U, T>,
470 "PtrVector: incompatible types");
472 return ptrs_.insert(position, p);
475 template <
typename T>
476 template <
typename U>
483 static_assert(std::is_same_v<T, U> || std::is_base_of_v<T, U> ||
484 std::is_base_of_v<U, T>,
485 "PtrVector: incompatible types");
487 ptrs_.insert(position, n, p);
490 template <
typename T>
491 template <
typename InputIterator>
502 template <
typename T>
509 template <
typename T>
513 return ptrs_.erase(first, last);
516 template <
typename T>
524 template <
typename T>
531 template <
typename T>
539 template <
typename T>
546 template <
typename T>
550 sort(std::less<T>{});
553 template <
typename T>
554 template <
class Comp>
561 template <
typename T>
566 assert(indices.empty());
567 indices.reserve(
ptrs_.size());
568 for (
auto const& i :
ptrs_) {
569 indices.push_back(i.key());
573 template <
typename T>
578 assert(
ptrs_.empty());
579 ptrs_.reserve(indices.size());
580 for (
auto i : indices) {
585 template <
typename T>
593 template <
typename T>
void swap(PtrVectorBase &)
typename data_t::allocator_type allocator_type
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
void reserve(size_type n)
bool operator==(Provenance const &a, Provenance const &b) noexcept
void swap(PtrVector< T > &, PtrVector< T > &)
typename data_t::iterator iterator
size_type max_size() const
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
typename data_t::difference_type difference_type
PtrVector< T > & operator=(std::initializer_list< Ptr< U >> il)
typename data_t::const_reference const_reference
void swap(PtrVector &other)
typename data_t::value_type value_type
void fill_offsets(indices_t &indices) override
bool operator==(PtrVectorBase const &) const noexcept
iterator erase(iterator position)
typename data_t::reverse_iterator reverse_iterator
const_reverse_iterator crbegin() const
void emplace_back(Args &&...args)
void resize(Vector< T > &vec1, Index n1, const V &val)
reverse_iterator rbegin()
std::vector< Ptr< recob::EndPoint2D >> data_t
size_type capacity() const
static short Class_Version()
const_reverse_iterator crend() const
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
void sort_all(RandCont &)
bool operator()(Ptr< T > const &a, Ptr< T > const &b)
std::vector< key_type > indices_t
ComparePtrs(Comp const comp)
fInnerVessel push_back(Point(-578.400000, 0.000000, 0.000000))
void fill_from_offsets(indices_t const &indices) const override
typename data_t::const_iterator const_iterator
void push_back(Ptr< U > const &p)
void swap(Handle< T > &a, Handle< T > &b)
typename data_t::const_reverse_iterator const_reverse_iterator
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
typename data_t::pointer pointer
reference at(size_type n)
const_iterator cbegin() const
EDProductGetter const * productGetter() const noexcept
iterator insert(iterator position, Ptr< U > const &p)
auto copy_all(FwdCont &, FwdIter)
typename data_t::reference reference
const_iterator cend() const
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
typename data_t::const_pointer const_pointer
vector< vector< double > > clear
void assign(size_type n, Ptr< U > const &p)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
typename data_t::size_type size_type
void updateCore(RefCore const &core)
indices_t::size_type size_type
Ptr< T > const & operator[](unsigned long const idx) const
bool operator==(PtrVector const &other) const
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
void zeroTransients() override
RefCore const & refCore() const noexcept