faunus
Public Types | Public Member Functions | List of all members
Faunus::ElasticRange< T > Class Template Reference

Turns a pair of iterators into an elastic range. More...

#include <group.h>

Inheritance diagram for Faunus::ElasticRange< T >:
Inheritance graph
[legend]
Collaboration diagram for Faunus::ElasticRange< T >:
Collaboration graph
[legend]

Public Types

using Titer = typename std::vector< T >::iterator
 
using const_iterator = typename std::vector< T >::const_iterator
 
using base = IterRange< typename std::vector< T >::iterator >
 

Public Member Functions

 ElasticRange (Titer begin, Titer end)
 
size_t capacity () const
 
auto inactive () const
 Range of inactive elements.
 
void deactivate (Titer first, Titer last)
 Deactivate particles by moving to end, reducing the effective size.
 
void activate (Titer first, Titer last)
 Activate previously deactivated elements.
 
Titer & trueend ()
 
const Titer & trueend () const
 
void relocate (const_iterator oldorigin, Titer neworigin)
 Shift all iterators to new underlying container; useful when resizing vectors.
 
virtual bool isFull () const
 
auto numInactive () const
 Number of inactive elements. More...
 
bool resizeIsPossible (int number_to_insert_or_delete) const
 
auto all ()
 Active and inactive elements.
 
auto all () const
 Active and inactive elements.
 
- Public Member Functions inherited from Faunus::IterRange< std::vector< T >::iterator >
std::vector< T >::iterator & begin ()
 
const std::vector< T >::iterator & begin () const
 
std::vector< T >::iterator & end ()
 
const std::vector< T >::iterator & end () const
 
size_t size () const
 
void resize (size_t n)
 
bool empty () const
 
void clear ()
 
std::pair< int, int > to_index (std::vector< T >::iterator reference) const
 Returns particle index pair relative to given reference.
 

Detailed Description

template<class T>
class Faunus::ElasticRange< T >

Turns a pair of iterators into an elastic range.

The elastic range is a range where elements can be deactivated and later activated without inserting/erasing:

Member Function Documentation

◆ numInactive()

template<class T >
auto Faunus::ElasticRange< T >::numInactive ( ) const

Number of inactive elements.

Determines if the given number (positive or negative) of particles can be inserted or deleted


The documentation for this class was generated from the following file: