|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
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 | |
| Container * | me () noexcept |
| const Container * | const_me () const noexcept |
| LocateFunctions< Container, Type > * | base () const |
Static Private Member Functions | |
| template<class Operation > | |
| static constexpr bool | operation_is_noexcept () noexcept |
Common sequential searching methods on containers.
This class implements common sequential searching on containers.
|
inlineprivate |
Definition at line 172 of file ah-dry.H.
Referenced by LocateFunctions< Container, Type >::find_ptr(), Aleph::ODhashTable< Key, Cmp >::key_to_bucket(), Aleph::OLhashTable< Key, Cmp >::key_to_bucket(), LocateFunctions< Container, Type >::nth(), LocateFunctions< Container, Type >::nth_ne(), and RingFileCache< T >::read_all().
|
inlineprivatenoexcept |
Definition at line 167 of file ah-dry.H.
Referenced by LocateFunctions< Container, Type >::find_index(), LocateFunctions< Container, Type >::get_it(), and LocateFunctions< Container, Type >::get_it().
|
inlinenoexcept |
|
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)
| [in] | operation | to be performed on each item for matching a searching criteria. |
Definition at line 393 of file ah-dry.H.
References LocateFunctions< Container, Type >::const_me().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Definition at line 450 of file ah-dry.H.
References LocateFunctions< Container, Type >::find_ptr(), and TT.
|
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)
| [in] | operation | to be used as searching criteria |
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.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Const overload of find_ptr(Operation&).
| [in] | operation | matching criteria |
Definition at line 340 of file ah-dry.H.
References LocateFunctions< Container, Type >::base().
|
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)
| [in] | operation | to be performed on each item for matching a searching criteria. |
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().
|
inline |
Return a properly initialized iterator positioned at the first item on the container.
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().
|
inline |
Return a properly initialized iterator positioned at the pos item on the container.
| [in] | pos | zero‑based position |
Definition at line 206 of file ah-dry.H.
References LocateFunctions< Container, Type >::const_me().
|
inline |
Alias of get_it().
Definition at line 218 of file ah-dry.H.
References LocateFunctions< Container, Type >::get_it().
|
inlineprivatenoexcept |
Definition at line 165 of file ah-dry.H.
Referenced by LocateFunctions< Container, Type >::find_ptr(), LocateFunctions< Container, Type >::nth(), and LocateFunctions< Container, Type >::nth_ne().
|
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.
| [in] | n | the nth item to find |
| out_of_range | if 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().
|
inline |
Const overload of nth(size_t).
| [in] | n | zero‑based index |
| out_of_range | if n is out of range |
Definition at line 290 of file ah-dry.H.
References LocateFunctions< Container, Type >::base().
|
inlinenoexcept |
Const overload of nth_ne(size_t).
| [in] | n | zero‑based index |
Definition at line 246 of file ah-dry.H.
References LocateFunctions< Container, Type >::base().
|
inlinenoexcept |
Return the n‑th element without bounds checking.
| [in] | n | zero‑based index |
Definition at line 226 of file ah-dry.H.
References LocateFunctions< Container, Type >::me().
|
inlinestaticconstexprprivatenoexcept |