libzed 1.9.9
A general-purpose library for quick and simple data manipulation.
 
Loading...
Searching...
No Matches
generic.cpp
#include <iostream>
#include <z/util/generic.hpp>
int main() {
// Don't throw error if no generic exists. Just make a dummy executable.
#ifdef Z_GENERIC_EXISTS
z::util::generic val1 = {"hello", 5.4, z::cplx(1.2, 4), {"a", "b"}};
z::util::generic val2 = "test";
std::cout << val1.typeString() << " : " << val1.toString(true) << std::endl;
std::cout << val2.typeString() << " : " << val2.toString(true) << std::endl;
#else
"ERROR: This program was compiled without support for z::util:generic!"_zs.writeln(std::cout);
"To use generics, please compile with STD=c++17 or greater."_zs.writeln(std::cout);
#endif
}
void writeln(std::ostream &stream) const noexcept
Write string data to a stream in its format, appending a newline.
Definition string.hpp:1507
A class for simple storage and manipulation of data regardless of type.
Definition generic.hpp:30
zstring toString(bool printArrays=false) const noexcept
Safely convert to a string.
zstring typeString() const noexcept
Get a character string representing the current type.