diff --git a/python/s_expr.cpp b/python/s_expr.cpp index 129d10801266277d017ee0c05f1471aa848d543a..6360713c3813b302662df47b0c69bef0fad482b7 100644 --- a/python/s_expr.cpp +++ b/python/s_expr.cpp @@ -1,5 +1,3 @@ -#include <iostream> - #include <cctype> #include <cstring> #include <string> @@ -7,8 +5,8 @@ #include <ostream> #include <vector> -#include <arbor/util/either.hpp> #include <arbor/arbexcept.hpp> +#include <arbor/util/variant.hpp> #include "s_expr.hpp" #include "strprintf.hpp" @@ -298,7 +296,7 @@ bool test_identifier(const char* in) { // bool s_expr::is_atom() const { - return (bool)state; + return state.index()==0; } const token& s_expr::atom() const { diff --git a/python/s_expr.hpp b/python/s_expr.hpp index 37975ee77275dd32c83904fc46d1af0f25d1cd59..8c4dd4336d06642aa07a4ec446f34ec54c607799 100644 --- a/python/s_expr.hpp +++ b/python/s_expr.hpp @@ -5,7 +5,7 @@ #include <vector> #include <arbor/util/either.hpp> -#include <arbor/util/optional.hpp> +#include <arbor/util/variant.hpp> namespace pyarb { @@ -85,12 +85,12 @@ struct s_expr { // An s_expr can be one of // 1. an atom // 2. a pair of s_expr (head and tail) - // The s_expr uses a util::either to represent these two possible states, - // which requires using an incomplete definition of s_expr, requiring - // with a std::shared_ptr. + // The s_expr uses a util::variant to represent these two possible states, + // which requires using an incomplete definition of s_expr, which is stored + // using a std::unique_ptr. using pair_type = s_pair<value_wrapper<s_expr>>; - arb::util::either<token, pair_type> state = token{-1, tok::nil, "nil"}; + arb::util::variant<token, pair_type> state = token{-1, tok::nil, "nil"}; s_expr(const s_expr& s): state(s.state) {} s_expr() = default; diff --git a/python/strprintf.hpp b/python/strprintf.hpp index 9e4687129fe1bbee314b3b02489117c122181dc0..5e2699bd41d3a91194d6107cf4d0b0e054eb11f7 100644 --- a/python/strprintf.hpp +++ b/python/strprintf.hpp @@ -13,8 +13,6 @@ #include <arbor/util/optional.hpp> -#include "s_expr.hpp" - namespace pyarb { namespace util {