|
Macaulay2 Engine
|
Conversion helpers between M2 boundary types and standard C++ containers. More...
#include <string>#include <vector>#include <iostream>#include "interface/m2-mem.h"#include "interface/m2-types.h"Go to the source code of this file.
Functions | |
| M2_string | string_std_to_M2 (const std::string &s) |
| std::string | string_M2_to_std (const M2_string s) |
| void | M2_ArrayString_to_stdvector (M2_ArrayString strs, std::vector< std::string > &result) |
| std::vector< std::string > | M2_ArrayString_to_stdvector (M2_ArrayString strs) |
| M2_ArrayString | stdvector_to_M2_ArrayString (const std::vector< std::string > &strs) |
| template<typename T> | |
| M2_arrayint | stdvector_to_M2_arrayint (const std::vector< T > &v) |
| template<typename T> | |
| std::vector< T > | M2_arrayint_to_stdvector (M2_arrayint arr) |
| template<typename T> | |
| std::ostream & | operator<< (std::ostream &o, const std::vector< T > &ts) |
Conversion helpers between M2 boundary types and standard C++ containers.
Provides the bidirectional converters every engine boundary needs, all inline so call sites stay free. Strings: string_std_to_M2 / string_M2_to_std marshal between std::string and M2_string (the engine's length-prefixed type). String arrays: M2_ArrayString_to_stdvector (in two overloads — one filling a caller-supplied std::vector<std::string>&, one returning a fresh vector) and stdvector_to_M2_ArrayString. Integer arrays: stdvector_to_M2_arrayint is templated on the element type T (with overloads for both std::vector<T> and gc_vector<T>), static_cast-ing each entry to int; the inverse M2_arrayint_to_stdvector<T> produces a fresh std::vector<T>. A trailing templated operator<<(std::ostream&, const std::vector<T>&) overload provides a [a b c ]-style debug dump for any printable element type.
Definition in file util.hpp.