TSDuck v3.38-3696
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
tsAlgorithm.h File Reference

Miscellaneous C++ algorithms supplementing the standard <algorithm>. More...

Classes

class  ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS >
 I/O manipulator with argument for subclasses of std::basic_ostream. More...
 

Namespaces

namespace  ts
 TSDuck namespace, containing all TSDuck classes and functions.
 

Functions

template<typename ELEMENT , class CONTAINER >
bool ts::AppendUnique (CONTAINER &container, const ELEMENT &e)
 Append an element into a container if not already present in the container.
 
template<class CONTAINER , class VALUE >
bool ts::Contains (const CONTAINER &container, const VALUE &value)
 Check if a value is present in a container.
 
template<class VALUE >
bool ts::Contains (const std::vector< VALUE > &container, const VALUE &value)
 Check if a value is present in a vector container.
 
template<typename T , class UnaryPredicate >
bool ts::EnumerateCombinations (const std::set< T > &values, const std::set< T > &fixed, size_t size, UnaryPredicate predicate)
 Enumerate all 'k'-elements combinations of a 'n'-elements set.
 
template<class OSTREAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & ts::IOManipulator (std::basic_ostream< typename OSTREAM::char_type, TRAITS > &strm, OSTREAM &(OSTREAM::*func)())
 I/O manipulator for subclasses of std::basic_ostream.
 
template<class CONTAINER >
size_t ts::LargestSize (const CONTAINER &container)
 Get the size of the largest object in a container of objects having a size() method.
 
template<class MAP >
std::list< typename MAP::key_type > ts::MapKeysList (const MAP &container)
 Get the list of all keys in a map.
 
template<class MAP >
std::set< typename MAP::key_type > ts::MapKeysSet (const MAP &container)
 Get the set of all keys in a map.
 
template<class MAP >
std::list< typename MAP::mapped_type > ts::MapValuesList (const MAP &container)
 Get the list of all values in a map.
 
template<class OSTREAM , class PARAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & operator<< (std::basic_ostream< typename OSTREAM::char_type, TRAITS > &strm, const ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS > &proxy)
 An overload of operator "<<" on std::basic_ostream for ts::IOManipulatorProxy.
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
std::vector< INTts::Range (INT first, INT last)
 Build a vector of integers containing all values in a range.
 
template<class CONTAINER >
void ts::RemoveDuplicates (CONTAINER &container)
 Remove duplicated elements in a container.
 
template<class CONTAINER >
size_t ts::SmallestSize (const CONTAINER &container)
 Get the size of the smallest object in a container of objects having a size() method.
 

Detailed Description

Miscellaneous C++ algorithms supplementing the standard <algorithm>.

This file declares several template functions implementing general-purpose algorithms. This header may be considered as an extension of the standard header <algorithm>, implementing other algorithms.

Function Documentation

◆ operator<<()

template<class OSTREAM , class PARAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & operator<< ( std::basic_ostream< typename OSTREAM::char_type, TRAITS > &  strm,
const ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS > &  proxy 
)

An overload of operator "<<" on std::basic_ostream for ts::IOManipulatorProxy.

Template Parameters
OSTREAMA subclass of std::basic_ostream.
PARAMThe type of the parameter for the manipulator.
Parameters
[in,out]strmThe stream of class OSTREAM to manipulate.
[in]proxyThe ts::IOManipulatorProxy object.
Returns
A reference to the strm object.
See also
ts::IOManipulatorProxy