CPP Homework 04
Exercise from OTUS C++ developer course.
helpers.h File Reference
#include <iostream>
#include <string>
#include <tuple>
Include dependency graph for helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T >
std::string to_string (T t)
 Wrapper function to make string. More...
 
std::string to_string (char ch)
 Wrapper function to make string. More...
 
std::string to_string (const char *ch)
 Wrapper function to make string. More...
 
std::string to_string (std::string const &s)
 Wrapper function to make string. More...
 
template<typename T1 , typename T2 >
void print_ip_tuple_impl (std::tuple< T1, T2 > const &t, std::ostream &stream=std::cout)
 Pretty print IP address. More...
 
template<typename Head , typename ... Tail>
void print_ip_tuple_impl (std::tuple< Head, Tail ... > const &t, std::ostream &stream=std::cout)
 Pretty print IP address. Print tuple as a dot-separated IP address. More...
 

Function Documentation

◆ print_ip_tuple_impl() [1/2]

template<typename T1 , typename T2 >
void print_ip_tuple_impl ( std::tuple< T1, T2 > const &  t,
std::ostream &  stream = std::cout 
)
private

Pretty print IP address.

Print pair as a dot-separated IP address.

Parameters
tTuple of two same typed items.
streamOutput stream to push in.
Exceptions
static_assertWhen items of tuple is not same typed.

Definition at line 59 of file helpers.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_ip_tuple_impl() [2/2]

template<typename Head , typename ... Tail>
void print_ip_tuple_impl ( std::tuple< Head, Tail ... > const &  t,
std::ostream &  stream = std::cout 
)
private

Pretty print IP address. Print tuple as a dot-separated IP address.

Parameters
tTuple of same typed items.
streamOutput stream to push in.
Exceptions
static_assertWhen items of tuple is not same typed.

Definition at line 73 of file helpers.h.

Here is the call graph for this function:

◆ to_string() [1/4]

template<typename T >
std::string to_string ( t)
private

Wrapper function to make string.

Function needs to uniformely get string from various types.

Parameters
tAny object that can be converted with std::string.
Returns
String made from arg..

Definition at line 17 of file helpers.h.

Here is the caller graph for this function:

◆ to_string() [2/4]

std::string to_string ( char  ch)
private

Wrapper function to make string.

Function needs to uniformely get string from various types.

Parameters
chAny char.
Returns
String containing given symbol.

Definition at line 27 of file helpers.h.

Here is the call graph for this function:

◆ to_string() [3/4]

std::string to_string ( const char *  ch)
private

Wrapper function to make string.

Function needs to uniformely get string from various types.

Parameters
chC-style string.
Returns
std::string constructed from given C-string.

Definition at line 37 of file helpers.h.

◆ to_string() [4/4]

std::string to_string ( std::string const &  s)
private

Wrapper function to make string.

Function needs to uniformely get string from various types.

Parameters
sRegular std::string.
Returns
Copy of input string.

Definition at line 47 of file helpers.h.