versatile-mcmc  0.1.7
Functions
stringutils.hpp File Reference

String utility functions. More...

#include <vmcmc/typetraits.hpp>
#include <sstream>
#include <string>
#include <utility>
Include dependency graph for stringutils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename SequenceT , typename SeparatorT >
std::ostream & vmcmc::join (std::ostream &stream, const SequenceT &sequence, const SeparatorT &separator="")
 Join an STL style container and output to a stream with its values joined by a separator. More...
 
template<typename SequenceT , typename SeparatorT >
std::string vmcmc::join (const SequenceT &sequence, const SeparatorT &separator, int floatPrecision=-1)
 Join an STL style container to a string. More...
 
std::ostream & vmcmc::operator<< (std::ostream &strm, const Sample &sample)
 Custom stream operator overload for Sample. More...
 
template<typename T1 , typename T2 >
std::ostream & vmcmc::operator<< (std::ostream &strm, const std::pair< T1, T2 > &pair)
 Serialize any STL pair to an output stream. More...
 
template<typename ContainerT , class = typename std::enable_if<vmcmc::is_container<ContainerT>::value>::type>
std::ostream & vmcmc::operator<< (std::ostream &strm, const ContainerT &container)
 Serialize any STL container to an output stream. More...
 

Detailed Description

String utility functions.

Date
29.07.2016
Author
marco.nosp@m.@kle.nosp@m.esiek.nosp@m..com

Function Documentation

template<typename SequenceT , typename SeparatorT >
std::ostream& vmcmc::join ( std::ostream &  stream,
const SequenceT &  sequence,
const SeparatorT &  separator = "" 
)
inline

Join an STL style container and output to a stream with its values joined by a separator.

Parameters
streamThe output stream.
sequenceThe container to be serialized. Must provide STL style iterators.
separatorThe separator to be inserted between printed values.
Returns
Reference to the output stream.
template<typename SequenceT , typename SeparatorT >
std::string vmcmc::join ( const SequenceT &  sequence,
const SeparatorT &  separator,
int  floatPrecision = -1 
)
inline

Join an STL style container to a string.

Parameters
sequenceThe container to be serialized. Must provide STL style iterators.
separatorThe separator to be inserted between serialized values.
Returns
The joined string.
std::ostream& vmcmc::operator<< ( std::ostream &  strm,
const Sample sample 
)

Custom stream operator overload for Sample.

Parameters
strm
sample
Returns
template<typename T1 , typename T2 >
std::ostream& vmcmc::operator<< ( std::ostream &  strm,
const std::pair< T1, T2 > &  pair 
)
inline

Serialize any STL pair to an output stream.

Parameters
strmAn output stream.
pairA pair.
Returns
Reference to the output stream.
template<typename ContainerT , class = typename std::enable_if<vmcmc::is_container<ContainerT>::value>::type>
std::ostream& vmcmc::operator<< ( std::ostream &  strm,
const ContainerT &  container 
)
inline

Serialize any STL container to an output stream.

Parameters
strmAn output stream.
containerA container fulfilling the type trait vmcmc::is_container.
Returns
Reference to the output stream.