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< Aleph::Gen_Euler_Tour_LCA::DepthEntry >, Aleph::Array< Node * >, Aleph::Array< Aleph::Array< size_t > >, Aleph::Array< value_type >, Aleph::Array< lazy_type >, Aleph::Array< Item >, Aleph::Array< Aleph::AABBTree::Node >, Aleph::Array< Aleph::AABBTree::Entry >, Aleph::Array< Aleph::AABBTree::DebugNode >, Aleph::Array< Aleph::AdversarialIterativeDeepeningIteration< Move, Score > >, Aleph::Array< Move >, Aleph::Array< Aleph::Aho_Corasick::Node >, Aleph::Array< std::string >, Aleph::Array< Aleph::Point >, Aleph::Array< Aleph::DelaunayTriangulationBowyerWatson::IndexedTriangle >, Aleph::Array< Aleph::Segment >, Aleph::Array< Aleph::Compact_Cuckoo_Filter::Bucket >, Aleph::Array< Aleph::ConstrainedDelaunayTriangulation::IndexedEdge >, Aleph::Array< Aleph::Convex_Hull_Trick::Line >, Aleph::Array< long double >, Aleph::Array< uint32_t >, Aleph::Array< Aleph::Cuckoo_Filter::Bucket >, Aleph::Array< Cost >, Aleph::Array< Complex >, Aleph::Array< Real >, Aleph::Array< Aleph::FFT::ISTFTProcessor >, Aleph::Array< Aleph::FFT::STFTProcessor >, Aleph::Array< Aleph::FFT::LFilter >, Aleph::Array< Aleph::Array< Real > >, Aleph::Array< bool >, Aleph::Array< Aleph::Array< Complex > >, Aleph::Array< Aleph::FFT::BiquadSection >, Aleph::Array< Aleph::FFT::IIRCoefficients >, Aleph::Array< Aleph::FFT::SOSFilter >, Aleph::Array< Aleph::detail::SPP_Portal >, Aleph::Array< Aleph::FunnelTraceStep >, Aleph::Array< char >, Aleph::Array< Aleph::lca_detail::Depth_Node >, Aleph::Array< Aleph::Gen_File_BPlus_Tree::Page >, Aleph::Array< unsigned char >, Aleph::Array< Aleph::Gen_File_B_Tree::Page >, Aleph::Array< typename GT::Node::Node_Type >, Aleph::Array< Aleph::Gen_Link_Cut_Tree::Node * >, Aleph::Array< Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeRec >, Aleph::Array< Aleph::Tree_Node * >, Aleph::Array< long >, Aleph::Array< uint8_t >, Aleph::Array< Aleph::IDAStarIteration< Distance > >, Aleph::Array< Aleph::KDTreePointSearch::DebugPartition >, Aleph::Array< std::optional< Move > >, Aleph::Array< Aleph::Array< Cost > >, Aleph::Array< Aleph::DynList< long > >, Aleph::Array< Aleph::Li_Chao_Tree::Node >, Aleph::Array< uint64_t >, Aleph::Array< Aleph::MonotonePolygonTriangulation::EdgeStatusTree::Node * >, Aleph::Array< Aleph::Naive_Suffix_Tree::Node >, Aleph::Array< Aleph::Planar_Dual_Metadata::Face_Boundary >, Aleph::Array< Aleph::Planar_Dual_Edge_Info< Aleph::List_Graph > >, Aleph::Array< Aleph::Planar_Dual_Metadata::Face_Dart >, Aleph::Array< Aleph::Planar_Geometric_Drawing::Node_Position >, Aleph::Array< Aleph::Planarity_Test_Result::Rotation_Entry >, Aleph::Array< Aleph::Array< Node * > >, Aleph::Array< Aleph::Planarity_Test_Result::Path_Witness >, Aleph::Array< Aleph::Planarity_Test_Result::Edge_Witness >, Aleph::Array< Arc * >, Aleph::Array< C >, Aleph::Array< Aleph::Polygon >, Aleph::Array< Aleph::PowerDiagram::WeightedSite >, Aleph::Array< Aleph::PowerDiagram::PowerEdge >, Aleph::Array< Aleph::PowerDiagram::PowerCell >, Aleph::Array< Aleph::RangeTree2D::Node >, Aleph::Array< Aleph::RangeTree2D::DebugNode >, Aleph::Array< Aleph::RegularTriangulationBowyerWatson::WeightedSite >, Aleph::Array< Aleph::SegmentArrangement::ArrEdge >, Aleph::Array< Aleph::SegmentArrangement::ArrFace >, Aleph::Array< Aleph::Segment_Tree_Beats::Node >, Aleph::Array< double >, Aleph::Array< Aleph::Suffix_Automaton::State >, Aleph::Array< Aleph::SweepLineSegmentIntersection::StatusTree::Node * >, Aleph::Array<::Polygon >, Aleph::Array<::Segment >, Aleph::Array<::Point >, Aleph::Array< Aleph::TrapezoidalMapPointLocation::Trapezoid >, Aleph::Array< Aleph::TrapezoidalMapPointLocation::DagNode >, Aleph::Array< __gmp_expr< mpq_t, mpq_t > >, Aleph::Array< Aleph::VoronoiDiagramFromDelaunay::Edge >, Aleph::Array< Aleph::VoronoiDiagramFromDelaunay::Cell >, Aleph::Array< VertexId >, Aleph::Array< Aleph::blossom_weighted_detail::mwmatching::impl::Blossom >, Aleph::Array< Aleph::blossom_weighted_detail::mwmatching::impl::Blossom * >, Aleph::Array< WeightType >, Aleph::Array< const Aleph::blossom_weighted_detail::mwmatching::Edge * >, Aleph::Array< Aleph::blossom_weighted_detail::mwmatching::Edge >, Aleph::Array< Aleph::Graph_Anode * >, Aleph::Array< Key >, Aleph::Array< std::unique_ptr< Aleph::detail::BPlusTreeNode > >, Aleph::Array< std::unique_ptr< Aleph::detail::BTreeNode > >, Aleph::Array< typename GT::Node * >, Aleph::Array< typename GT::Arc * >, Aleph::Array< Aleph::planarity_detail::Simple_Edge >, Aleph::Array< Aleph::Array< Arc * > >, Aleph::Array< Aleph::planarity_detail::Conflict_Pair >, 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< Aleph::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< VertexPair >, Aleph::DynDlist< Aleph::blossom_weighted_detail::mwmatching::impl::NonTrivialBlossom >, Aleph::DynDlist< Aleph::blossom_weighted_detail::mwmatching::impl::NonTrivialBlossom::SubBlossom >, Aleph::DynDlist< const Aleph::blossom_weighted_detail::mwmatching::Edge< WeightType > * >, 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::DynHashTable< std::pair< Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeKey, size_t >, Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeKeyEq, Dft_Pair_Cmp< Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeKey, size_t, Aleph::equal_to< Aleph::Gen_Link_Cut_Tree_WithEdges::EdgeKey > > >, Aleph::DynHashTable< std::pair< Node *, int >, Aleph::Gen_Link_Cut_Tree_WithEdges::NodePtrEq, Dft_Pair_Cmp< Node *, int, Aleph::equal_to< Node * > > >, Aleph::DynList< int >, Aleph::DynList< Event >, 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< long >, Aleph::DynList< typename GT::Node * >, Aleph::DynList< Aleph::Point >, Aleph::DynList< Solution >, Aleph::DynList< size_t >, Aleph::DynList< Aleph::Tree_Node * >, Aleph::DynList< std::pair< Node *, Aleph::Zero_One_BFS::Node_Info * > >, Aleph::DynList< std::pair< Node *, Aleph::Zero_One_BFS::Painted_Info * > >, Aleph::DynList< VertexId >, Aleph::DynList< Aleph::DynList< int > >, Aleph::DynList< QueueTheadsPool::ConsumerQueueEvent * >, Aleph::DynList< char >, Aleph::DynList< string >, Aleph::DynList< std::string >, Aleph::DynList< std::thread >, Aleph::DynListQueue< size_t >, Aleph::DynListQueue< VertexId >, 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< Aleph::Array< size_t >, double >, Aleph::Avl_Tree, Dft_Pair_Cmp< Aleph::Array< size_t >, double, Grevlex_Order > >, Aleph::DynSetTree< std::pair< size_t, double >, Avl_Tree, Dft_Pair_Cmp< size_t, double, Aleph::less< size_t > > >, 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< Aleph::LineSweepFramework::SeqEvent, Aleph::Avl_Tree, Aleph::LineSweepFramework::CmpSeqEvent >, 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< Aleph::VisibilityPolygon::EdgeStatusTree::EdgeKey, Aleph::Treap, Aleph::VisibilityPolygon::EdgeStatusTree::EdgeKeyCmp >, Aleph::DynSetTree< std::pair< Pair_Key, Arc * >, Avl_Tree, Dft_Pair_Cmp< Pair_Key, Arc *, Aleph::less< Pair_Key > > >, Aleph::DynSetTree< Arc * >, Aleph::DynSetTree< std::pair< Node *, Cost_Type >, Avl_Tree, Dft_Pair_Cmp< Node *, Cost_Type, Aleph::less< Node * > > >, Aleph::DynSetTree< std::pair< Node *, Arc * >, Avl_Tree, Dft_Pair_Cmp< Node *, Arc *, Aleph::less< 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 the 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 criterion.
 
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() const that accepts rvalues.
 
template<class Operation >
Type * find_ptr (Operation &&operation) noexcept(operation_is_noexcept< Operation >())
 Overload of find_ptr() 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 criterion.
 
template<class Operation >
size_t find_index (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_index() 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 criterion.
 
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 >())
 Overload of find_item() that accepts rvalues.
 
template<class Operation >
std::tuple< bool, Type > find_item (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Overload of find_item() const that accepts rvalues.
 
template<class Operation >
bool contains_if (Operation &&operation) const noexcept(operation_is_noexcept< Operation >())
 Test if an item satisfying a criterion is present in the container.
 
bool contains (const Type &item) const
 Test if an item is present in the container using equality.
 

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 into 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 the container.

Definition at line 195 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

◆ contains()

template<class Container , typename Type >
bool LocateFunctions< Container, Type >::contains ( const Type &  item) const
inline

Test if an item is present in the container using equality.

Parameters
[in]itemelement to search for.
Returns
true if item is found, false otherwise.
Exceptions
Anythingpropagated by operator== for Type.

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

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

Referenced by TEST().

◆ contains_if()

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

Test if an item satisfying a criterion is present in the container.

Template Parameters
OperationSearch criterion callable.
Parameters
[in]operationmatching criterion.
Returns
true if an item satisfying operation is found, false otherwise.
Exceptions
Anythingpropagated by evaluating operation(item).

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

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

Referenced by LocateFunctions< Container, Type >::contains().

◆ 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationSearch criterion callable.
Parameters
[in]operationmatching criterion.
Returns
position of first matching element or size if none.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

Definition at line 462 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 criterion.

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 criterion.
Returns
the last seen position. If the item is not found, then the number of items is returned.

Definition at line 436 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

Overload of find_item() const that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationSearching criterion callable.
Parameters
[in]operationmatching criterion.
Returns
a duple std::tuple<bool, Type>.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

Definition at line 537 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

Overload of find_item() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationSearching criterion callable.
Parameters
[in]operationmatching criterion.
Returns
a duple std::tuple<bool, Type>.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

Definition at line 519 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 499 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 criterion.

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 criterion
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 489 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() const that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationMatching criterion callable.
Parameters
[in]operationmatching criterion.
Returns
const pointer to matching element or nullptr.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

Definition at line 389 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() that accepts rvalues.

The operation is passed (invoked) as a named lvalue to the lvalue-reference overload rather than being perfectly forwarded.

Template Parameters
OperationMatching criterion callable.
Parameters
[in]operationmatching criterion.
Returns
pointer to matching element or nullptr.
Exceptions
Maythrow the same exceptions as the corresponding lvalue overload; no additional exception-safety guarantees are provided.

Definition at line 407 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 criterion
Returns
const pointer to matching element or nullptr

Definition at line 371 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 criterion.

find_ptr(operation) traverses the container and on each item performs 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 fall into the situation, then consider your design and use a faster approach.
Parameters
[in]operationto be performed on each item for matching a searching criterion.
Returns
a valid pointer to an item if this was found or nullptr otherwise.

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

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

Referenced by LocateFunctions< Container, Type >::contains_if(), LocateFunctions< Container, Type >::find_item(), and LocateFunctions< Container, Type >::find_item().

◆ 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 222 of file ah-dry.H.

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

Referenced by Aleph::Gen_Fenwick_Tree< T, Plus, Minus >::Gen_Fenwick_Tree(), Aleph::Gen_Lazy_Segment_Tree< Policy >::Gen_Lazy_Segment_Tree(), build_complete_bipartite(), Aleph::chromatic_number(), Aleph::AHMapping< Key, ValueType >::contains_value(), Aleph::Simplex< T >::count_artificial_vars(), Aleph::Simplex< T >::create_matrix(), Aleph::decompose_flow(), demo_bfs_topological_sort(), demo_biconnected_components(), demo_build_order(), demo_config_store(), demo_coverage_area(), demo_cut_nodes(), demo_fixing_vulnerabilities(), demo_joining(), demo_network_vulnerability(), demo_practical(), demo_triangulation_basic(), demo_triangulation_complex(), demo_word_frequency(), Aleph::dynlist_to_DynArray(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::factorize(), Aleph::foldr(), Aleph::AHMapping< Key, ValueType >::for_each(), 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::Simplex< T >::get_restriction(), Aleph::AHMapping< Key, ValueType >::inverse(), Aleph::Simplex< T >::latex_linear_program(), main(), Aleph::k_shortest_paths_detail::make_path_snapshot(), Aleph::DynDlist< T >::operator[](), Aleph::perm_count(), Aleph::Network_Simplex< Net >::pivot_tree(), print_dynlist(), print_list(), Aleph::rank_graphviz(), Aleph::DynList< T >::reverse(), Aleph::DynDlist< T >::reverse(), Aleph::Simplex< T >::rhs_sensitivity(), Aleph::k_shortest_paths_detail::same_path_sequence(), 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_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::to_string(), Aleph::transpose(), Aleph::traverse_perm(), Aleph::tunzip(), TYPED_TEST_P(), Aleph::tzip_longest(), Aleph::Zero_One_BFS< GT, Distance, Itor, SA >::uninit_paint(), Aleph::unzip(), Aleph::Simplex< T >::update_rhs_and_reoptimize(), Aleph::AHMapping< Key, ValueType >::values(), verify_bipartition(), 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 238 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 250 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 the container.

The notion of ordinal depends on the type of container. On a 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 299 of file ah-dry.H.

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

Referenced by 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 322 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 278 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 258 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 210 of file ah-dry.H.


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