Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Utilities.h File Reference
#include "Stroika/Foundation/StroikaPreComp.h"
#include <set>
#include <vector>
#include "Stroika/Foundation/Common/Common.h"
#include "Stroika/Foundation/Common/Compare.h"
#include "Utilities.inl"

Go to the source code of this file.

Namespaces

namespace  Stroika::Foundation
 
namespace  Stroika::Foundation::Containers
 

Functions

template<typename ITERABLE_OF_T , typename T = typename ITERABLE_OF_T::value_type, Common::IPotentiallyComparer< T > EQUALS_COMPARER = equal_to<T>>
bool Stroika::Foundation::Containers::STL::equal (const ITERABLE_OF_T &lhs, const ITERABLE_OF_T &rhs, EQUALS_COMPARER &&equalsComparer={})
 
template<typename TARGET_CONTAINER >
void Stroika::Foundation::Containers::STL::Append (TARGET_CONTAINER *v)
 
template<typename TARGET_CONTAINER , typename SRC_CONTAINER , typename... Args>
TARGET_CONTAINER Stroika::Foundation::Containers::STL::Concat (const SRC_CONTAINER &v2, Args... args)
 construct a new STL container by concatenating the args together.
 
template<typename SRC_CONTAINER , typename... Args>
vector< typename SRC_CONTAINER::value_type > Stroika::Foundation::Containers::STL::Concatenate (const SRC_CONTAINER &v2, Args... args)
 construct a new vector<T> by concatenating the args together. Alias for Concat<vector<typename SRC_CONTAINER::value_type>> ()
 
template<typename T >
bool Stroika::Foundation::Containers::STL::Intersects (const set< T > &s1, const set< T > &s2)
 
template<typename T >
set< T > Stroika::Foundation::Containers::STL::Intersection (const set< T > &s1, const set< T > &s2)
 

Detailed Description

Note
Code-Status: Alpha

Definition in file Containers/STL/Utilities.h.

Function Documentation

◆ equal()

template<typename ITERABLE_OF_T , typename T = typename ITERABLE_OF_T::value_type, Common::IPotentiallyComparer< T > EQUALS_COMPARER = equal_to<T>>
bool Stroika::Foundation::Containers::STL::equal ( const ITERABLE_OF_T &  lhs,
const ITERABLE_OF_T &  rhs,
EQUALS_COMPARER &&  equalsComparer = {} 
)
Note
similar to std::equal () - but takes iterables as arguments, not iterators

Definition at line 11 of file Containers/STL/Utilities.inl.

◆ Append()

template<typename TARGET_CONTAINER >
void Stroika::Foundation::Containers::STL::Append ( TARGET_CONTAINER *  v)

Though you can append to a vector<> with insert (this->begin (), arg.begin (), arg.end ()) That's awkward if 'arg' is an unnamed value - say the result of a function. You must assign to a named temporary. This helper makes that unneeded.

Definition at line 33 of file Containers/STL/Utilities.inl.

◆ Concat()

template<typename TARGET_CONTAINER , typename SRC_CONTAINER , typename... Args>
TARGET_CONTAINER Stroika::Foundation::Containers::STL::Concat ( const SRC_CONTAINER &  v2,
Args...  args 
)

construct a new STL container by concatenating the args together.

Note
Hard to believe this is so awkward in STL!
See also
Concatenate

Definition at line 59 of file Containers/STL/Utilities.inl.

◆ Concatenate()

template<typename SRC_CONTAINER , typename... Args>
vector< typename SRC_CONTAINER::value_type > Stroika::Foundation::Containers::STL::Concatenate ( const SRC_CONTAINER &  v2,
Args...  args 
)

construct a new vector<T> by concatenating the args together. Alias for Concat<vector<typename SRC_CONTAINER::value_type>> ()

See also
Concat

Definition at line 72 of file Containers/STL/Utilities.inl.

◆ Intersects()

template<typename T >
bool Stroika::Foundation::Containers::STL::Intersects ( const set< T > &  s1,
const set< T > &  s2 
)

Returns true if the intersetion of s1 and s2 is non-empty

Definition at line 83 of file Containers/STL/Utilities.inl.

◆ Intersection()

template<typename T >
set< T > Stroika::Foundation::Containers::STL::Intersection ( const set< T > &  s1,
const set< T > &  s2 
)
 @todo - redo with RHS as arbirrary container. Probably redo with stroika Set<>

maybe osbolete cuz can alway use (Containers::Set<T> (s1) & s2).As<vector<T>> ()

Definition at line 111 of file Containers/STL/Utilities.inl.