|
| array_key ()=default |
| Defaulted default constructor. More...
|
|
| array_key (const array_key &)=default |
| Defaulted copy constructor. More...
|
|
| array_key (array_key &&)=default |
| Defaulted move constructor.
|
|
template<typename U , init_list_enabler< U > = 0> |
| array_key (std::initializer_list< U > list) |
| Constructor from initializer list. More...
|
|
| array_key (const symbol_fset &args) |
| Constructor from piranha::symbol_fset. More...
|
|
template<typename U , typename Derived2 , typename S2 , generic_ctor_enabler< U > = 0> |
| array_key (const array_key< U, Derived2, S2 > &other, const symbol_fset &args) |
| Constructor from piranha::array_key parametrized on a generic type. More...
|
|
| ~array_key () |
| Trivial destructor.
|
|
array_key & | operator= (const array_key &other)=default |
| Copy assignment operator. More...
|
|
array_key & | operator= (array_key &&other)=default |
| Move assignment operator. More...
|
|
iterator | begin () |
| Begin iterator. More...
|
|
iterator | end () |
| End iterator. More...
|
|
const_iterator | begin () const |
| Begin const iterator. More...
|
|
const_iterator | end () const |
| End const iterator. More...
|
|
size_type | size () const |
| Size. More...
|
|
void | resize (const size_type &new_size) |
| Resize the internal array container. More...
|
|
value_type & | operator[] (const size_type &i) |
| Element access. More...
|
|
const value_type & | operator[] (const size_type &i) const |
| Const element access. More...
|
|
std::size_t | hash () const |
| Hash value. More...
|
|
void | push_back (value_type &&x) |
| Move-add element at the end. More...
|
|
void | push_back (const value_type &x) |
| Copy-add element at the end. More...
|
|
bool | operator== (const array_key &other) const |
| Equality operator. More...
|
|
bool | operator!= (const array_key &other) const |
| Inequality operator. More...
|
|
void | trim_identify (std::vector< char > &trim_mask, const symbol_fset &args) const |
| Identify symbols that can be trimmed. More...
|
|
Derived | trim (const std::vector< char > &trim_mask, const symbol_fset &args) const |
| Trim. More...
|
|
template<typename U = container_type, add_enabler< U > = 0> |
void | vector_add (array_key &retval, const array_key &other) const |
| Vector add. More...
|
|
template<typename U = container_type, sub_enabler< U > = 0> |
void | vector_sub (array_key &retval, const array_key &other) const |
| Vector sub. More...
|
|
Derived | merge_symbols (const symbol_idx_fmap< symbol_fset > &ins_map, const symbol_fset &args) const |
| Merge symbols. More...
|
|
auto | size_begin_end () const -> decltype(m_container.size_begin_end()) |
| Get size, begin and end iterator (const version). More...
|
|
auto | size_begin_end () -> decltype(m_container.size_begin_end()) |
| Get size, begin and end iterator. More...
|
|
template<typename T, typename Derived, typename S = std::integral_constant<std::size_t, 0u>>
class piranha::array_key< T, Derived, S >
Array key.
This class represents an array-like dense sequence of instances of type T
. Interface and semantics mimic those of std::vector
. The underlying container used to store the elements is piranha::small_vector. The template argument S
is passed as second argument to piranha::small_vector in the definition of the internal container.
This class is intended as a base class for the implementation of a key type, but it does not satisfy all the requirements specified in piranha::is_key.
Type requirements
Exception safety guarantee
Unless otherwise specified, this class provides the strong exception safety guarantee for all operations.
Move semantics
Move semantics is equivalent to the move semantics of piranha::small_vector.
Definition at line 86 of file array_key.hpp.
template<typename T, typename Derived, typename S = std::integral_constant<std::size_t, 0u>>
template<typename U , init_list_enabler< U > = 0>
Constructor from initializer list.
- Note
- This constructor is enabled only if piranha::small_vector is constructible from
list
.
list
will be forwarded to construct the internal piranha::small_vector.
- Parameters
-
list | the initializer list. |
- Exceptions
-
Definition at line 139 of file array_key.hpp.
template<typename T, typename Derived, typename S = std::integral_constant<std::size_t, 0u>>
template<typename U , typename Derived2 , typename S2 , generic_ctor_enabler< U > = 0>
Constructor from piranha::array_key parametrized on a generic type.
- Note
- This constructor is enabled only if
U
can be cast safely to the value type.
Generic constructor for use in piranha::series, when inserting a term of different type. The internal container will be initialised with the contents of the internal container of x
(possibly converting the individual contained values through piranha::safe_cast(), if the values are of different type). If the size of x
is different from the size of args
, a runtime error will be produced.
- Parameters
-
- Exceptions
-
std::invalid_argument | if the sizes of x and args differ. |
unspecified | any exception thrown by:
|
Definition at line 185 of file array_key.hpp.
template<typename T, typename Derived, typename S = std::integral_constant<std::size_t, 0u>>
Merge symbols.
This method will return a copy of this
in which the value 0 has been inserted at the positions specified by ins_map
. Specifically, before each index appearing in ins_map
a number of zeroes equal to the size of the mapped piranha::symbol_fset will be inserted.
For instance, given a piranha::array_key containing the values [1,2,3,4]
, a symbol set args
containing ["c","e","g","h"]
and an insertion map ins_map
containing the pairs [(0,["a","b"]),(1,["d"]),(2,["f"]),(4,["i"])]
, the output of this method will be [0,0,1,0,2,0,3,4,0]
. That is, the symbols appearing in ins_map
are merged into this
with a value of zero at the specified positions.
- Parameters
-
ins_map | the insertion map. |
args | the reference symbol set for this . |
- Returns
- a
Derived
instance resulting from inserting into this
zeroes at the positions specified by ins_map
.
- Exceptions
-
std::invalid_argument | in the following cases:
- the size of
this is different from the size of args ,
- the size of
ins_map is zero,
- the last index in
ins_map is greater than the size of this .
|
unspecified | any exception thrown by:
|
Definition at line 508 of file array_key.hpp.
template<typename T, typename Derived, typename S = std::integral_constant<std::size_t, 0u>>
Trim.
This method is used in piranha::series::trim(). The input mask trim_mask
is a vector of boolean flags signalling (with nonzero values) elements of this
to be removed. The method will return a copy of this
in which the specified elements have been removed.
For instance, if this
contains the values [0,5,3,0,4]
and trim_mask
contains the values [false,false,false,true,false]
, then the output of this method will be the array of values [0,5,3,4]
(that is, the fourth element has been removed as indicated by a true
value in trim_mask
's fourth element).
- Parameters
-
- Returns
- a trimmed copy of
this
.
- Exceptions
-
std::invalid_argument | if the sizes of this or trim_mask differ from the size of args . |
unspecified | any exception thrown by push_back(). |
Definition at line 409 of file array_key.hpp.
template<typename T, typename Derived, typename S = std::integral_constant<std::size_t, 0u>>
Identify symbols that can be trimmed.
This method is used in piranha::series::trim(). The input parameter trim_mask
is a vector of boolean flags (i.e., a mask) which signals which elements in args
are candidates for trimming: a nonzero value means that the symbol at the corresponding position is a candidate for trimming, while a zero value means that the symbol is not a candidate for trimming. This method will set to zero those values in trim_mask
for which the corresponding element in this
is nonzero.
For instance, if this
contains the values [0,5,3,0,4]
and trim_mask
originally contains the values [1,1,0,1,0]
, after a call to this method trim_mask
will contain [1,0,0,1,0]
(that is, the second element was set from 1 to 0 as the corresponding element in this
has a value of 5 and thus it must not be trimmed).
- Parameters
-
- Exceptions
-
std::invalid_argument | if the sizes of this or trim_mask differ from the size of args . |
unspecified | any exception thrown by piranha::math::is_zero(). |
Definition at line 367 of file array_key.hpp.