Carna Version 3.3.3
Loading...
Searching...
No Matches
Functions
Carna::base::text Namespace Reference

Provides text-related helper functions. More...

Functions

std::string cat (const std::string &file)
 Reads file in text mode and returns contents.
 
template<typename To , typename From >
To lexical_cast (const From &from)
 Performs lexical cast.
 

Detailed Description

Provides text-related helper functions.

Function Documentation

◆ lexical_cast()

template<typename To , typename From >
To Carna::base::text::lexical_cast ( const From from)

Performs lexical cast.

Example:

\code
using Carna::base::text::lexical_cast;

const unsigned int i = 3;
const  std::string s = lexical_cast<  std::string >( i );
const unsigned int j = lexical_cast< unsigned int >( s );

CARNA_ASSERT( i == j );
\endcode

Definition at line 68 of file text.h.