Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::glop::StrictITIVector< IntType, T, Alloc > Class Template Reference

#include <lp_types.h>

Inheritance diagram for operations_research::glop::StrictITIVector< IntType, T, Alloc >:
util_intops::StrongVector< IntType, NativeType, Alloc >

Public Types

using IndexType = IntType
 
using ParentType = util_intops::StrongVector<IntType, T, Alloc>
 
using View = StrictITISpan<IntType, T>
 
using ConstView = StrictITISpan<IntType, const T>
 
- Public Types inherited from util_intops::StrongVector< IntType, NativeType, Alloc >
typedef std::vector< NativeType, Alloc > ParentType
 
typedef ParentType::size_type size_type
 
typedef ParentType::allocator_type allocator_type
 
typedef ParentType::value_type value_type
 
typedef ParentType::reference reference
 
typedef ParentType::const_reference const_reference
 
typedef ParentType::pointer pointer
 
typedef ParentType::const_pointer const_pointer
 
typedef ParentType::iterator iterator
 
typedef ParentType::const_iterator const_iterator
 
typedef ParentType::reverse_iterator reverse_iterator
 
typedef ParentType::const_reverse_iterator const_reverse_iterator
 

Public Member Functions

 StrictITIVector ()=default
 
 StrictITIVector (IntType size)
 
 StrictITIVector (const Alloc &a)
 
 StrictITIVector (IntType n, const T &v, const Alloc &a=Alloc())
 
 StrictITIVector (std::initializer_list< T > init_list, const Alloc &a=Alloc())
 
template<typename InputIteratorType >
 StrictITIVector (InputIteratorType first, InputIteratorType last, const Alloc &a=Alloc())
 
void resize (IntType size)
 
void resize (IntType size, const T &v)
 
void reserve (IntType size)
 
void assign (IntType size, const T &v)
 
IntType size () const
 
IntType capacity () const
 
View view ()
 
ConstView const_view () const
 
ConstView view () const
 
StrictITIVectoroperator= (ConstView data)
 
void resize_down (IntType size)
 
void AssignToZero (IntType size)
 
- Public Member Functions inherited from util_intops::StrongVector< IntType, NativeType, Alloc >
 StrongVector ()
 
 StrongVector (const allocator_type &a)
 
 StrongVector (size_type n)
 
 StrongVector (IntType n)
 
 StrongVector (size_type n, const value_type &v, const allocator_type &a=allocator_type())
 
 StrongVector (IntType n, const value_type &v, const allocator_type &a=allocator_type())
 
 StrongVector (const StrongVector &x)
 
 StrongVector (StrongVector &&x)=default
 
 StrongVector (std::initializer_list< value_type > l, const allocator_type &a=allocator_type())
 
template<typename InputIteratorType >
 StrongVector (InputIteratorType first, InputIteratorType last, const allocator_type &a=allocator_type())
 
 ~StrongVector ()
 
const ParentTypeget () const
 
ParentTypemutable_get ()
 
reference operator[] (IntType i)
 – Modified methods ----------------------------------------------------—
 
const_reference operator[] (IntType i) const
 
reference at (IntType i)
 
const_reference at (IntType i) const
 
IntType start_index () const
 – Extension methods ---------------------------------------------------—
 
IntType end_index () const
 
bool IsValidSize () const
 Returns true if the vector is fully addressable by the index type.
 
StrongIntRange< IntType > index_range () const
 
value_typedata ()
 – Pass-through methods to STL vector ----------------------------------—
 
const value_typedata () const
 
StrongVectoroperator= (const StrongVector &x)
 
StrongVectoroperator= (StrongVector &&x)=default
 
StrongVectoroperator= (std::initializer_list< value_type > l)
 
void swap (StrongVector &x) noexcept
 
void assign (size_type n, const value_type &val)
 
template<typename InputIt >
void assign (InputIt f, InputIt l)
 
void assign (std::initializer_list< value_type > l)
 
template<typename... Args>
iterator emplace (const_iterator pos, Args &&... args)
 
template<typename... Args>
reference emplace_back (Args &&... args)
 
iterator insert (const_iterator pos, const value_type &x)
 
iterator insert (const_iterator pos, value_type &&x)
 
void insert (const_iterator pos, size_type n, const value_type &x)
 
template<typename SIT >
void insert (const_iterator pos, SIT first, SIT last)
 
void push_back (const value_type &val)
 
void push_back (value_type &&val)
 
void reserve (size_type n)
 
void reserve (IntType n)
 
void resize (size_type new_size)
 
void resize (IntType new_size)
 
void resize (size_type new_size, const value_type &x)
 
void resize (IntType new_size, const value_type &x)
 

Detailed Description

template<typename IntType, typename T, typename Alloc = std::allocator<T>>
class operations_research::glop::StrictITIVector< IntType, T, Alloc >

Wrapper around a StrongVector to allow (and enforce) creation/resize/assign to use the index type for the size.

Todo
(user): This should probably move to StrongVector, but note that this version is stricter and does not allow any other size types.

Definition at line 288 of file lp_types.h.

Member Typedef Documentation

◆ ConstView

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
using operations_research::glop::StrictITIVector< IntType, T, Alloc >::ConstView = StrictITISpan<IntType, const T>

Definition at line 293 of file lp_types.h.

◆ IndexType

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
using operations_research::glop::StrictITIVector< IntType, T, Alloc >::IndexType = IntType

Definition at line 290 of file lp_types.h.

◆ ParentType

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
using operations_research::glop::StrictITIVector< IntType, T, Alloc >::ParentType = util_intops::StrongVector<IntType, T, Alloc>

Definition at line 291 of file lp_types.h.

◆ View

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
using operations_research::glop::StrictITIVector< IntType, T, Alloc >::View = StrictITISpan<IntType, T>

Definition at line 292 of file lp_types.h.

Constructor & Destructor Documentation

◆ StrictITIVector() [1/6]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
operations_research::glop::StrictITIVector< IntType, T, Alloc >::StrictITIVector ( )
default

◆ StrictITIVector() [2/6]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
operations_research::glop::StrictITIVector< IntType, T, Alloc >::StrictITIVector ( IntType size)
inlineexplicit

Definition at line 296 of file lp_types.h.

◆ StrictITIVector() [3/6]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
operations_research::glop::StrictITIVector< IntType, T, Alloc >::StrictITIVector ( const Alloc & a)
inlineexplicit

Definition at line 297 of file lp_types.h.

◆ StrictITIVector() [4/6]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
operations_research::glop::StrictITIVector< IntType, T, Alloc >::StrictITIVector ( IntType n,
const T & v,
const Alloc & a = Alloc() )
inline

Definition at line 298 of file lp_types.h.

◆ StrictITIVector() [5/6]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
operations_research::glop::StrictITIVector< IntType, T, Alloc >::StrictITIVector ( std::initializer_list< T > init_list,
const Alloc & a = Alloc() )
inline

This allows for brace initialization, which is really useful in tests. It is not 'explicit' by design, so one can do vector = {...};

Definition at line 304 of file lp_types.h.

◆ StrictITIVector() [6/6]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
template<typename InputIteratorType >
operations_research::glop::StrictITIVector< IntType, T, Alloc >::StrictITIVector ( InputIteratorType first,
InputIteratorType last,
const Alloc & a = Alloc() )
inline

Definition at line 310 of file lp_types.h.

Member Function Documentation

◆ assign()

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
void operations_research::glop::StrictITIVector< IntType, T, Alloc >::assign ( IntType size,
const T & v )
inline

Definition at line 319 of file lp_types.h.

◆ AssignToZero()

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
void operations_research::glop::StrictITIVector< IntType, T, Alloc >::AssignToZero ( IntType size)
inline

This function can be up to 4 times faster than calling assign(size, 0).

Note
it only works with StrictITIVector of basic types.

Definition at line 344 of file lp_types.h.

◆ capacity()

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
IntType operations_research::glop::StrictITIVector< IntType, T, Alloc >::capacity ( ) const
inline

Definition at line 323 of file lp_types.h.

◆ const_view()

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
ConstView operations_research::glop::StrictITIVector< IntType, T, Alloc >::const_view ( ) const
inline

Definition at line 326 of file lp_types.h.

◆ operator=()

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
StrictITIVector & operations_research::glop::StrictITIVector< IntType, T, Alloc >::operator= ( ConstView data)
inline

Definition at line 329 of file lp_types.h.

◆ reserve()

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
void operations_research::glop::StrictITIVector< IntType, T, Alloc >::reserve ( IntType size)
inline

Definition at line 317 of file lp_types.h.

◆ resize() [1/2]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
void operations_research::glop::StrictITIVector< IntType, T, Alloc >::resize ( IntType size)
inline

Definition at line 314 of file lp_types.h.

◆ resize() [2/2]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
void operations_research::glop::StrictITIVector< IntType, T, Alloc >::resize ( IntType size,
const T & v )
inline

Definition at line 315 of file lp_types.h.

◆ resize_down()

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
void operations_research::glop::StrictITIVector< IntType, T, Alloc >::resize_down ( IntType size)
inline

Since calls to resize() must use a default value, we introduce a new function for convenience to reduce the size of a vector.

Definition at line 336 of file lp_types.h.

◆ size()

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
IntType operations_research::glop::StrictITIVector< IntType, T, Alloc >::size ( ) const
inline

Definition at line 321 of file lp_types.h.

◆ view() [1/2]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
View operations_research::glop::StrictITIVector< IntType, T, Alloc >::view ( )
inline

Definition at line 325 of file lp_types.h.

◆ view() [2/2]

template<typename IntType , typename T , typename Alloc = std::allocator<T>>
ConstView operations_research::glop::StrictITIVector< IntType, T, Alloc >::view ( ) const
inline

Definition at line 327 of file lp_types.h.


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