souffle  2.0.2-371-g6315b36
Data Structures | Namespaces | Typedefs | Functions
ContainerUtil.h File Reference
#include <algorithm>
#include <functional>
#include <iterator>
#include <map>
#include <memory>
#include <set>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for ContainerUtil.h:

Go to the source code of this file.

Data Structures

struct  souffle::comp_deref< T >
 A functor class supporting the values pointers are pointing to. More...
 
struct  souffle::IterDerefWrapper< Iter, T >
 A wrapper for an iterator obtaining pointers of a certain type, dereferencing values before forwarding them to the consumer. More...
 
struct  souffle::range< Iter >
 A utility class enabling representation of ranges by pairing two iterator instances marking lower and upper boundaries. More...
 
struct  souffle::reverse< A >
 Use to range-for iterate in reverse. More...
 
class  souffle::SingleValueIterator< T >
 An iterator to be utilized if there is only a single element to iterate over. More...
 

Namespaces

 souffle
 

Typedefs

template<typename A >
using souffle::Own = std::unique_ptr< A >
 
template<typename A >
using souffle::VecOwn = std::vector< Own< A > >
 

Functions

template<typename toType , typename baseType >
bool souffle::castEq (const baseType *left, const baseType *right)
 Cast the values, from baseType to toType and compare using ==. More...
 
template<typename A >
auto souffle::clone (const std::vector< A * > &xs)
 
template<typename A >
auto souffle::clone (const std::vector< std::unique_ptr< A >> &xs)
 
template<typename C >
bool souffle::contains (const C &container, const typename C::value_type &element)
 A utility to check generically whether a given element is contained in a given container. More...
 
template<typename C >
bool souffle::contains (const C &container, const typename C::value_type::first_type &element)
 Version of contains specialised for maps. More...
 
template<typename A >
bool souffle::contains (const std::set< A > &container, const A &element)
 
template<typename Iter >
IterDerefWrapper< Iter > souffle::derefIter (const Iter &iter)
 A factory function enabling the construction of a dereferencing iterator utilizing the automated deduction of template parameters. More...
 
template<typename Container , typename Comparator >
bool souffle::equal_targets (const Container &a, const Container &b, const Comparator &comp)
 A function testing whether two containers are equal with the given Comparator. More...
 
template<typename T , template< typename... > class Container>
bool souffle::equal_targets (const Container< std::unique_ptr< T >> &a, const Container< std::unique_ptr< T >> &b)
 A function testing whether two containers of unique pointers are referencing equivalent targets. More...
 
template<typename T , template< typename... > class Container>
bool souffle::equal_targets (const Container< T * > &a, const Container< T * > &b)
 A function testing whether two containers of pointers are referencing equivalent targets. More...
 
template<typename Key , typename Value >
bool souffle::equal_targets (const std::map< Key, std::unique_ptr< Value >> &a, const std::map< Key, std::unique_ptr< Value >> &b)
 A function testing whether two maps of unique pointers are referencing to equivalent targets. More...
 
template<typename C >
C::value_type souffle::getIf (const C &container, std::function< bool(const typename C::value_type)> pred)
 Returns the first element in a container that satisfies a given predicate, nullptr otherwise. More...
 
template<typename C >
C::mapped_type const & souffle::getOr (const C &container, typename C::key_type key, const typename C::mapped_type &defaultValue)
 Get value for a given key; if not found, return default value. More...
 
template<typename Iter >
range< Iter > souffle::make_range (const Iter &a, const Iter &b)
 A utility function enabling the construction of ranges without explicitly specifying the iterator type. More...
 
template<typename A , typename F >
auto souffle::map (const std::vector< A > &xs, F &&f)
 Applies a function to each element of a vector and returns the results. More...
 
template<typename A , typename B = A, typename... Args>
Own< A > souffle::mk (Args &&... xs)
 
template<typename T >
std::vector< T * > souffle::toPtrVector (const std::vector< std::unique_ptr< T >> &v)
 A utility function enabling the creation of a vector of pointers. More...
 
template<typename T >
std::vector< T > souffle::toVector ()
 A utility function enabling the creation of a vector with a fixed set of elements within a single expression. More...
 
template<typename T , typename... R>
std::vector< T > souffle::toVector (const T &first, const R &... rest)
 A utility function enabling the creation of a vector with a fixed set of elements within a single expression. More...