void PlotAgent::add_point(double x, double y, const string& v) { assert(ndim == 3); plot_os << x << '\t' << y << '\t' << v << '\n'; add_x(x); add_y(y); add_v(atof(v.chars())); }
void PlotAgent::add_point(double x, const string& v) { if (ndim > 2) add_point(x, 0.0, v); else { plot_os << x << '\t' << v << '\n'; add_x(x); add_v(atof(v.chars())); } }
int main() { { auto a = new Y<X>; a->x = 10; auto b = new Z<Z<Y<X>>>; b->base = new Z<Y<X>>; b->base->base = new Y<X>; b->base->base->x = 20; std::cout << x(a) << std::endl; std::cout << x(b) << std::endl; } //.. { auto a = new Z<X>; auto b = new Z<Z<Y<Z<X>>>>; std::cout << typeid(decltype(add_x(a))).name() << std::endl; // should be Y<Z<X>> std::cout << typeid(decltype(add_x(b))).name() << std::endl; // should remain Z<Z<Y<Z<X>>>> } return 0; }