5 #include <yaml-cpp/yaml.h> 7 #include "../utilities/complexnumber_parser.hpp" 12 struct convert<
std::complex<double> > {
13 static Node
encode(
const std::complex<double> & rhs) {
14 if (rhs.imag() == 0.0) {
17 else if (rhs.real() == 0.0) {
20 else if (rhs.imag() < 0.0) {
28 static bool decode(
const Node& node, std::complex<double> & rhs) {
29 std::string str = node.as<std::string>();
32 if (str.size() >= 2 && str.front() ==
'(' && str.back() ==
')')
33 str = str.substr(1, str.size()-2);
std::string to_string(T in)
Definition: to_string.hpp:10
Definition: stdarray2stream.hpp:7
static bool decode(const Node &node, std::complex< double > &rhs)
Definition: complex.hpp:28
bool parse_complex(char const *text, std::complex< double > &result)
Definition: complexnumber_parser.cpp:9
Definition: complex.hpp:10
static Node encode(const std::complex< double > &rhs)
Definition: complex.hpp:13