Skip to content
Snippets Groups Projects
Unverified Commit ce9a9bae authored by Benjamin Cumming's avatar Benjamin Cumming Committed by GitHub
Browse files

remove arb::util::either from Python interface (#1138)

Switch `arb::util::either` to `arb::util::variant` in the Python wrapper.

Fixes #1133 
parent 0f0102ae
No related branches found
No related tags found
No related merge requests found
#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 {
......
......@@ -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;
......
......@@ -13,8 +13,6 @@
#include <arbor/util/optional.hpp>
#include "s_expr.hpp"
namespace pyarb {
namespace util {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment