Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
LocateFunctions< Container, Type > Class Template Reference

Common sequential searching methods on containers. More...

#include <ah-dry.H>

Inherited by Aleph::Array< size_t >, Aleph::Array< std::string >, Aleph::Array< int >, Aleph::Array< Aleph::Array< std::string > >, Aleph::Array< string >, Aleph::ArrayQueue< int >, Aleph::ArrayQueue< Aleph::DynList< int > >, Aleph::ArrayStack< Node * >, Aleph::ArrayStack< int >, Aleph::ArrayStack< Aleph::DynList< int > >, Aleph::DynArray< GT_Node * >, Aleph::DynArray< Point >, Aleph::DynArray< Node * >, Aleph::DynArray< Entry_Type >, Aleph::DynArray< typename GT::Arc * >, Aleph::DynArray< Aleph::Byte >, Aleph::DynArray< typename GT::Node * >, Aleph::DynArray< long >, Aleph::DynArray< Distance_Type >, Aleph::DynArray< Dnode< Key > >, Aleph::DynArray< Aleph::Map_Matrix_Graph::Mat_Entry >, Aleph::DynArray< Node_Type >, Aleph::DynArray< Arc_Type >, Aleph::DynArray< Aleph::Simplex_Node_Info >, Aleph::DynArray< Aleph::Simplex_Arc_Info >, Aleph::DynArray< string >, Aleph::DynArray< int >, Aleph::DynArray< Event_Handler >, Aleph::DynArray< size_t >, Aleph::DynArray< void * >, Aleph::DynArray< Aleph::DynArray< Node * > >, Aleph::DynArray< double >, Aleph::DynDlist< typename GT::Node * >, Aleph::DynDlist< Aleph::Path::Path_Desc >, Aleph::DynDlist< T * >, Aleph::DynDlist< ConstraintType >, Aleph::DynDlist< int >, Aleph::DynDlist< Tag_Data >, Aleph::DynDlist< Arc_Desc >, Aleph::DynDlist< Thread_Desc >, Aleph::DynDlist< Eepic_Geom_Object * >, Aleph::DynDlist< Polinomio::Termino >, Aleph::DynDlist< Arc_Data >, Aleph::DynDlist< Connexion_Data >, Aleph::DynHashTable< std::pair< Key, Data >, LhashTable, Dft_Pair_Cmp< Key, Data, Aleph::equal_to< Key > > >, Aleph::DynHashTable< Key, LhashTable, Aleph::equal_to< Key > >, Aleph::DynHashTable< Key, LinearHashTable, Aleph::equal_to< Key > >, Aleph::DynList< int >, Aleph::DynList< std::pair< size_t, size_t > >, Aleph::DynList< typename GT::Arc * >, Aleph::DynList< Arc * >, Aleph::DynList< Node * >, Aleph::DynList< Aleph::FlowPath< Aleph::Net_Graph > >, Aleph::DynList< Aleph::FlowCycle< Aleph::Net_Graph > >, Aleph::DynList< void * >, Aleph::DynList< typename GT::Node * >, Aleph::DynList< Aleph::Tree_Node * >, Aleph::DynList< Aleph::DynList< int > >, Aleph::DynList< size_t >, Aleph::DynList< Point >, Aleph::DynList< QueueTheadsPool::ConsumerQueueEvent * >, Aleph::DynList< char >, Aleph::DynList< string >, Aleph::DynList< std::string >, Aleph::DynList< std::thread >, Aleph::DynListQueue< Aleph::DynList< int > >, Aleph::DynListQueue< int >, Aleph::DynListStack< typename GT::Node * >, Aleph::DynListStack< Aleph::Tree_Node * >, Aleph::DynListStack< Aleph::DynList< int > >, Aleph::DynListStack< int >, Aleph::DynListStack< string >, Aleph::DynMatrix< long >, Aleph::DynMatrix< Distance_Type >, Aleph::DynMatrix< int >, Aleph::DynMatrix< double >, Aleph::DynSetTree< GT::Arc *, Treap, Dft_Arc_Cmp< GT > >, Aleph::DynSetTree< std::pair< Key, Type >, Avl_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, BinTree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Rand_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Rb_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Splay_Tree, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Treap, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Type >, Treap_Rk, Dft_Pair_Cmp< Key, Type, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, Data >, Avl_Tree, Dft_Pair_Cmp< Key, Data, Aleph::less< Key > > >, Aleph::DynSetTree< Key, Avl_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Avl_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, BinTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, HtdRbTreeRk, Aleph::less< Key > >, Aleph::DynSetTree< Key, HtdRbTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rand_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rb_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Rb_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Splay_Tree_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Key, Splay_Tree, Aleph::less< Key > >, Aleph::DynSetTree< Key, TdRbTreeRk, Aleph::less< Key > >, Aleph::DynSetTree< Key, TdRbTree, Aleph::less< Key > >, Aleph::DynSetTree< Key, Treap, Aleph::less< Key > >, Aleph::DynSetTree< Key, Treap_Rk, Aleph::less< Key > >, Aleph::DynSetTree< Node * >, Aleph::DynSetTree< GT::Node *, Treap, Dft_Node_Cmp< GT > >, Aleph::DynSetTree< GT_Arc *, Rand_Tree, Aleph::IndexArc::Cmp_Arc >, Aleph::DynSetTree< std::pair< Key, Operation >, Avl_Tree, Dft_Pair_Cmp< Key, Operation, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< Key, ValueType >, Avl_Tree, Dft_Pair_Cmp< Key, ValueType, Aleph::less< Key > > >, Aleph::DynSetTree< std::pair< void *, Flow_Type >, Avl_Tree, Dft_Pair_Cmp< void *, Flow_Type, Aleph::less< void * > > >, Aleph::DynSetTree< std::pair< Node *, Node * >, Treap, Dft_Pair_Cmp< Node *, Node *, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< std::string, Huffman_Node * >, Treap_Vtl, Dft_Pair_Cmp< std::string, Huffman_Node *, Aleph::less< std::string > > >, Aleph::DynSetTree< std::pair< std::string, BitArray >, Treap_Vtl, Dft_Pair_Cmp< std::string, BitArray, Aleph::less< std::string > > >, Aleph::DynSetTree< GT_Node *, Treap, Dft_Node_Cmp< GT > >, Aleph::DynSetTree< GT_Arc *, Treap, Aleph::IndexArc::Cmp_Arc >, Aleph::DynSetTree< std::pair< int, int >, Avl_Tree, Aleph::less< std::pair< int, int > > >, Aleph::DynSetTree< std::pair< Node *, Node * >, Avl_Tree, Dft_Pair_Cmp< Node *, Node *, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Arc *, Arc * >, Avl_Tree, Dft_Pair_Cmp< Arc *, Arc *, Aleph::less< Arc * > > >, Aleph::DynSetTree< std::pair< Node *, Distance_Type >, Avl_Tree, Dft_Pair_Cmp< Node *, Distance_Type, Aleph::less< Node * > > >, Aleph::DynSetTree< Node *, Rand_Tree >, Aleph::DynSetTree< Arc *, Rand_Tree >, Aleph::DynSetTree< std::pair< Node *, size_t >, Avl_Tree, Dft_Pair_Cmp< Node *, size_t, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Arc *, size_t >, Avl_Tree, Dft_Pair_Cmp< Arc *, size_t, Aleph::less< Arc * > > >, Aleph::DynSetTree< GT_Node *, Rand_Tree, Aleph::less< GT_Node * > >, Aleph::DynSetTree< int >, Aleph::DynSetTree< GT_Node *, Treap, TestNodeCmp >, Aleph::DynSetTree< Relation_T::Pair, Avl_Tree, Relation_T::Cmp >, Aleph::DynSetTree< std::pair< Event::EventId, TimeoutQueue::Event * >, Avl_Tree, Dft_Pair_Cmp< Event::EventId, TimeoutQueue::Event *, Aleph::less< Event::EventId > > >, Aleph::DynSetTree< TimeoutQueue::Event * >, Aleph::DynSetTree< size_t >, Aleph::DynSkipList< int >, Aleph::FixedQueue< Aleph::DynList< int > >, Aleph::FixedQueue< int >, Aleph::FixedQueue< void * >, Aleph::FixedStack< Node * >, Aleph::FixedStack< Aleph::RbNodeRk * >, Aleph::FixedStack< RbNode * >, Aleph::FixedStack< Aleph::DynList< int > >, Aleph::FixedStack< int >, Aleph::ODhashTable< P, AhHashDispatcher::Equal >, Aleph::ODhashTable< int >, Aleph::OLhashTable< int >, Aleph::Random_Set< int >, Aleph::ArrayHeap< T, Compare >, Aleph::DynArrayHeap< T, Compare >, Aleph::DynBinHeap< T, Compare >, Aleph::DynDlist< T >, Aleph::DynHashTable< Key, HashTable, Cmp >, Aleph::DynList< T >, Aleph::DynSetTree< Key, Tree, Compare >, Aleph::DynSkipList< Key, Compare >, Aleph::ODhashTable< Key, Cmp >, and Aleph::OLhashTable< Key, Cmp >.

Public Member Functions

auto get_it () const
 Return a properly initialized iterator positioned at the first item on the container.
 
auto get_it (const size_t pos) const
 Return a properly initialized iterator positioned at the pos item on the container.
 
auto get_itor () const
 Alias of get_it().
 
Type & nth_ne (const size_t n) noexcept
 Return the n‑th element without bounds checking.
 
const Type & nth_ne (const size_t n) const noexcept
 Const overload of nth_ne(size_t).
 
Type & nth (const size_t n)
 Return the n-th item of container.
 
const Type & nth (const size_t n) const
 Const overload of nth(size_t).
 
template<class Operation >
Type * find_ptr (Operation &operation) noexcept(operation_is_noexcept< Operation >())
 Find a pointer to an item in the container according to a searching criteria.
 
template<class Operation >
const Type * find_ptr (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 Const overload of find_ptr(Operation&).
 
template<class Operation >
const Type * find_ptr (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr(Operation&) const that accepts rvalues.
 
template<class Operation >
Type * find_ptr (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr(Operation&) that accepts rvalues.
 
template<class Operation >
size_t find_index (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 Find the position of an item in the container according to a searching criteria.
 
template<class Operation >
size_t find_index (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_index(Operation&) that accepts rvalues.
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &operation) noexcept(operation_is_noexcept< Operation >())
 Safe sequential searching of an item matching a criteria.
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &operation) const noexcept(operation_is_noexcept< Operation >())
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 

Private Member Functions

Containerme () noexcept
 
const Containerconst_me () const noexcept
 
LocateFunctions< Container, Type > * base () const
 

Static Private Member Functions

template<class Operation >
static constexpr bool operation_is_noexcept () noexcept
 

Detailed Description

template<class Container, typename Type>
class LocateFunctions< Container, Type >

Common sequential searching methods on containers.

This class implements common sequential searching on containers.

Note
Take in account that any of these searches takes \(O(n)\) of complexity for the worst case and that this is independent of type of container. For example, a hash table or a binary search tree, exports its own search that is much faster that any of these primitives. As an advice: do not use this method inside loops. If you find yourself in this situation, then consider to revise your design and to use another search method. Use these primitives very few times, for algorithms whose complexity is by far greater that \(O(n)\) and when you cannot index with an adequate data structure.
Warning
Be very careful about the fact that many of these primitives return pointers or references to container's data. In many cases, alteration of that data will corrupt the internal state of container.

Definition at line 163 of file ah-dry.H.

Member Function Documentation

◆ base()

◆ const_me()

template<class Container , typename Type >
const Container * LocateFunctions< Container, Type >::const_me ( ) const
inlineprivatenoexcept

◆ find_index() [1/2]

template<class Container , typename Type >
template<class Operation >
size_t LocateFunctions< Container, Type >::find_index ( Operation &&  operation) const
inlinenoexcept

Overload of find_index(Operation&) that accepts rvalues.

Parameters
[in]operationmatching criteria
Returns
position of first matching element or size if none

Definition at line 413 of file ah-dry.H.

◆ find_index() [2/2]

template<class Container , typename Type >
template<class Operation >
size_t LocateFunctions< Container, Type >::find_index ( Operation &  operation) const
inlinenoexcept

Find the position of an item in the container according to a searching criteria.

find_index(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and the position of the current item (which matches operation) is returned.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)

Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in this situation, the consider your design and use a faster approach.
Parameters
[in]operationto be performed on each item for matching a searching criteria.
Returns
the last seen position. If the item is not found, then the number of items is returned.

Definition at line 393 of file ah-dry.H.

References LocateFunctions< Container, Type >::const_me().

◆ find_item() [1/4]

template<class Container , typename Type >
template<class Operation >
std::tuple< bool, Type > LocateFunctions< Container, Type >::find_item ( Operation &&  operation) const
inlinenoexcept

Definition at line 468 of file ah-dry.H.

◆ find_item() [2/4]

template<class Container , typename Type >
template<class Operation >
std::tuple< bool, Type > LocateFunctions< Container, Type >::find_item ( Operation &&  operation)
inlinenoexcept

Definition at line 460 of file ah-dry.H.

◆ find_item() [3/4]

template<class Container , typename Type >
template<class Operation >
std::tuple< bool, Type > LocateFunctions< Container, Type >::find_item ( Operation &  operation) const
inlinenoexcept

Definition at line 450 of file ah-dry.H.

References LocateFunctions< Container, Type >::find_ptr(), and TT.

◆ find_item() [4/4]

template<class Container , typename Type >
template<class Operation >
LocateFunctions< Container, Type >::find_item ( Operation &  operation)
inlinenoexcept

Safe sequential searching of an item matching a criteria.

find_item(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and duple containing a copy of found item is returned.

The method is said safe because returns a copy of item.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)

Parameters
[in]operationto be used as searching criteria
Returns
a duple std::tuple<bool, Type>. The first field indicates if the item was found and the second contains a copy of found item. If no item is found, then the first field is false and the second is the result of default constructor on the type stored in the container.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 440 of file ah-dry.H.

References LocateFunctions< Container, Type >::find_ptr(), and TT.

◆ find_ptr() [1/4]

template<class Container , typename Type >
template<class Operation >
const Type * LocateFunctions< Container, Type >::find_ptr ( Operation &&  operation) const
inlinenoexcept

Overload of find_ptr(Operation&) const that accepts rvalues.

Parameters
[in]operationmatching criteria
Returns
const pointer to matching element or nullptr

Definition at line 352 of file ah-dry.H.

◆ find_ptr() [2/4]

template<class Container , typename Type >
template<class Operation >
Type * LocateFunctions< Container, Type >::find_ptr ( Operation &&  operation)
inlinenoexcept

Overload of find_ptr(Operation&) that accepts rvalues.

Parameters
[in]operationmatching criteria
Returns
pointer to matching element or nullptr

Definition at line 364 of file ah-dry.H.

◆ find_ptr() [3/4]

template<class Container , typename Type >
template<class Operation >
const Type * LocateFunctions< Container, Type >::find_ptr ( Operation &  operation) const
inlinenoexcept

Const overload of find_ptr(Operation&).

Parameters
[in]operationmatching criteria
Returns
const pointer to matching element or nullptr

Definition at line 340 of file ah-dry.H.

References LocateFunctions< Container, Type >::base().

◆ find_ptr() [4/4]

template<class Container , typename Type >
template<class Operation >
Type * LocateFunctions< Container, Type >::find_ptr ( Operation &  operation)
inlinenoexcept

Find a pointer to an item in the container according to a searching criteria.

find_ptr(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and a pointer to the current item (which matches operation) is returned.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)

Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in the situation, the consider your design and to use a faster approach.
Parameters
[in]operationto be performed on each item for matching a searching criteria.
Returns
a valid pointer to an item if this was found or nullptr otherwise.

Definition at line 318 of file ah-dry.H.

References LocateFunctions< Container, Type >::me().

Referenced by LocateFunctions< Container, Type >::find_item(), LocateFunctions< Container, Type >::find_item(), Aleph::BruteForceConvexHull::operator()(), and TEST().

◆ get_it() [1/2]

template<class Container , typename Type >
auto LocateFunctions< Container, Type >::get_it ( ) const
inline

Return a properly initialized iterator positioned at the first item on the container.

Returns
iterator positioned at the first element

Definition at line 190 of file ah-dry.H.

References LocateFunctions< Container, Type >::const_me().

Referenced by Aleph::Gen_Fenwick_Tree< T, Plus, Minus >::Gen_Fenwick_Tree(), Aleph::all_ready(), Aleph::are_eq(), Aleph::assign_container(), Aleph::concat(), Aleph::AHMapping< Key, ValueType >::contains_value(), Aleph::Simplex< T >::count_artificial_vars(), Aleph::count_ready(), Aleph::Matrix< Trow, Tcol, NumType >::create_by_rows(), Aleph::Simplex< T >::create_matrix(), Aleph::decompose_flow(), demo_adjacency_matrix(), demo_basic_operations(), demo_bfs_topological_sort(), demo_biconnected_components(), demo_build(), demo_build_order(), demo_config_store(), demo_conversion(), demo_convex_hull_cities(), demo_course_scheduling(), demo_coverage_area(), demo_cut_nodes(), demo_cycle_detection(), demo_dfs_topological_sort(), demo_enum_zip(), demo_erdos_renyi(), demo_find_sccs(), demo_fixing_vulnerabilities(), demo_fold(), demo_joining(), demo_matrix_vector_mult(), demo_named_matrix(), demo_network_vulnerability(), demo_perm_predicates(), demo_permutations(), demo_practical(), demo_practical_example(), demo_row_col_operations(), demo_string_indexed_vector(), demo_traverse(), demo_triangulation_basic(), demo_triangulation_complex(), demo_tuple_conversions(), demo_tuple_operations(), demo_variadic_packing(), demo_word_frequency(), demo_zip_transformation(), demo_zip_utilities(), demonstrate_flow_decomposition(), Aleph::dynlist_to_DynArray(), Aleph::eq(), Aleph::flatten(), Aleph::foldr(), Aleph::AHMapping< Key, ValueType >::for_each(), Aleph::format_string_csv(), Aleph::generate_dot_file(), Aleph::DynHashTable< Key, HashTable, Cmp >::get_first(), Aleph::DynHashTable< Key, HashTable, Cmp >::get_first(), LocateFunctions< Container, Type >::get_itor(), Aleph::DynHashTable< Key, HashTable, Cmp >::get_last(), Aleph::DynHashTable< Key, HashTable, Cmp >::get_last(), Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::get_min_path(), Aleph::get_min_path(), Aleph::Simplex< T >::get_restriction(), Aleph::group_by_reduce(), Aleph::hopcroft_karp_matching(), Aleph::AHMapping< Key, ValueType >::inverse(), is_valid_topological_order(), Aleph::Simplex< T >::latex_linear_program(), Aleph::lesser(), main(), Aleph::Johnson< GT, Distance, Ait, NAit, SA >::map_copy_path_to_original(), Aleph::map_cut_graph(), Aleph::DynDlist< T >::operator[](), Aleph::paint_subgraphs(), Aleph::perm_count(), Aleph::Network_Simplex< Net >::pivot_tree(), print_dynlist(), print_list(), print_matching(), print_matrix(), Aleph::rank_graphviz(), Aleph::DynList< T >::reverse(), Aleph::DynDlist< T >::reverse(), Aleph::Simplex< T >::rhs_sensitivity(), Aleph::shift_lines_to_left(), Aleph::MCF_LP_Solver< Net >::solve(), Aleph::t_unzip_impl(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::to_string(), Aleph::to_string(), Aleph::transpose(), Aleph::traverse_perm(), Aleph::tunzip(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST_P(), TYPED_TEST_P(), Aleph::tzip_longest(), Aleph::uni_compare(), Aleph::uni_concat(), Aleph::uni_equal(), Aleph::uni_flat_map(), Aleph::uni_flatten(), Aleph::unzip(), Aleph::Simplex< T >::update_rhs_and_reoptimize(), Aleph::AHMapping< Key, ValueType >::values(), verify_bipartition(), verify_matching(), Aleph::Simplex< T >::verify_solution(), Aleph::zip_longest(), Aleph::zip_longest_opt(), and Aleph::zipEq().

◆ get_it() [2/2]

template<class Container , typename Type >
auto LocateFunctions< Container, Type >::get_it ( const size_t  pos) const
inline

Return a properly initialized iterator positioned at the pos item on the container.

Parameters
[in]poszero‑based position
Returns
iterator positioned at the requested position

Definition at line 206 of file ah-dry.H.

References LocateFunctions< Container, Type >::const_me().

◆ get_itor()

template<class Container , typename Type >
auto LocateFunctions< Container, Type >::get_itor ( ) const
inline

Alias of get_it().

Returns
iterator positioned at the first element

Definition at line 218 of file ah-dry.H.

References LocateFunctions< Container, Type >::get_it().

◆ me()

template<class Container , typename Type >
Container * LocateFunctions< Container, Type >::me ( )
inlineprivatenoexcept

◆ nth() [1/2]

template<class Container , typename Type >
Type & LocateFunctions< Container, Type >::nth ( const size_t  n)
inline

Return the n-th item of container.

The notion of ordinal depends on type of container. On list, probably will be the insertion order. On binary search trees will be the nth smaller item. On hash tables will be pseudo random.

Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in this situation, then consider your design and to use a faster approach.
Parameters
[in]nthe nth item to find
Returns
a valid reference to the item into the container.
Exceptions
out_of_rangeif n is greater or equal that the size of container.

Definition at line 267 of file ah-dry.H.

References ah_out_of_range_error_if, and LocateFunctions< Container, Type >::me().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ nth() [2/2]

template<class Container , typename Type >
const Type & LocateFunctions< Container, Type >::nth ( const size_t  n) const
inline

Const overload of nth(size_t).

Parameters
[in]nzero‑based index
Returns
const reference to the n‑th element
Exceptions
out_of_rangeif n is out of range

Definition at line 290 of file ah-dry.H.

References LocateFunctions< Container, Type >::base().

◆ nth_ne() [1/2]

template<class Container , typename Type >
const Type & LocateFunctions< Container, Type >::nth_ne ( const size_t  n) const
inlinenoexcept

Const overload of nth_ne(size_t).

Warning
No bounds checking is performed.
Parameters
[in]nzero‑based index
Returns
const reference to the n‑th element

Definition at line 246 of file ah-dry.H.

References LocateFunctions< Container, Type >::base().

◆ nth_ne() [2/2]

template<class Container , typename Type >
Type & LocateFunctions< Container, Type >::nth_ne ( const size_t  n)
inlinenoexcept

Return the n‑th element without bounds checking.

Warning
No bounds checking is performed.
Parameters
[in]nzero‑based index
Returns
mutable reference to the n‑th element

Definition at line 226 of file ah-dry.H.

References LocateFunctions< Container, Type >::me().

◆ operation_is_noexcept()

template<class Container , typename Type >
template<class Operation >
static constexpr bool LocateFunctions< Container, Type >::operation_is_noexcept ( )
inlinestaticconstexprprivatenoexcept

Definition at line 178 of file ah-dry.H.


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