String utility functions.
More...
#include <vmcmc/typetraits.hpp>
#include <sstream>
#include <string>
#include <utility>
Go to the source code of this file.
|
| 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...
|
| |
String utility functions.
- Copyright
- Copyright 2016 Marco Kleesiek. Released under the GNU Lesser General Public License v3.
- Date
- 29.07.2016
- Author
- marco.nosp@m.@kle.nosp@m.esiek.nosp@m..com
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
-
| stream | The output stream. |
| sequence | The container to be serialized. Must provide STL style iterators. |
| separator | The 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
-
| sequence | The container to be serialized. Must provide STL style iterators. |
| separator | The 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
-
- 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
-
| strm | An output stream. |
| pair | A 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
-
- Returns
- Reference to the output stream.