18 #ifndef REVARTABLE_LIST_HH_
19 #define REVARTABLE_LIST_HH_
67 data_.reserve(new_size);
85 return data_.capacity();
113 template<
class... Args>
121 data_.emplace_back( std::forward<Args>(args)... );
151 return data_.begin();
#define ASSERT_PERMANENT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
#define ASSERT_LT(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
#define ASSERT_GE(a, b)
Definition of comparative assert macro (Greater or Equal) only for debug mode.
Struct is a container that encapsulates variable size arrays.
std::size_t revert_temporary()
Erase temporary part of data.
std::vector< Type >::iterator begin()
void resize(std::size_t new_size)
std::size_t reserved_size() const
Return reserved (maximal) size.
std::size_t enlarged_by_
Allow to enlarge list dynamically during call push_back if reserved size is full.
std::vector< Type >::iterator end()
std::size_t permanent_size_
Final size of data (part of finalize data).
std::size_t make_permanent()
Finalize temporary part of data.
std::vector< Type > data_
Vector of items.
std::size_t push_back(const Type &t)
RevertableList(const RevertableList &other)
Copy constructor.
void reset()
Clear the list.
const Type & operator[](std::size_t pos) const
Return item on given position.
std::size_t temporary_size_
Temporary size (full size of used data).
std::size_t emplace_back(Args &&... args)
std::size_t temporary_size() const
Return temporary size of list (full size of stored data).
RevertableList(std::size_t reserved_size, std::size_t enlarged_by=0)
Constructor, create new instance with reserved size.
std::size_t permanent_size() const
Return permanent size of list.