#include "autodif.hpp" int main() { autodif<2> x, y, f; x = autodif<2>(2.0, 0); y = autodif<2>(1.0, 1); f = (x - y) * (x * x + y) + x * y; std::cout << x << "\n"; std::cout << y << "\n"; std::cout << f << "\n"; }のような感じのインターフェースはどうだろうか。 (初期化時の第2引数0,1は何番目の変数であるかを指定している。)