einsums::from_string#

Note

Generated from the C++ headers by apiary --emit-cpp-docs-json.

Defined in header Einsums/StringUtil/FromString.hpp.

template<typename T, typename Char>
T from_string(const std::basic_string<Char> &v)#

Converts a string to a value.

Added in version 1.0.0.

Template Parameters:
  • T – The type to convert to.

  • Char – The kind of character.

Parameters:

v – The string to convert.

Throws:

bad_lexical_cast – Throws if the string could not be converted.

Returns:

The value represented by the input string.

template<typename T, typename U, typename Char>
T from_string(const std::basic_string<Char> &v, U &&default_value)#

Converts a string to a value.

Added in version 1.0.0.

Template Parameters:
  • T – The type to convert to.

  • Char – The kind of character.

  • U – The type of the default value.

Parameters:
  • v – The string to convert.

  • default_value – The default value if the string could not be converted.

Returns:

The value represented by the string, or the default value if the string could not be converted.