Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: no member named 'get_pointer' with std::variant #7

Open
alanjohnjames opened this issue Mar 31, 2020 · 0 comments
Open

error: no member named 'get_pointer' with std::variant #7

alanjohnjames opened this issue Mar 31, 2020 · 0 comments

Comments

@alanjohnjames
Copy link

I am getting compiler errors when using simple_match on a std::variant

[build] /Users/alan/Git/simple_match/include/simple_match/implementation/some_none.hpp:120:73: error: no member named 'get_pointer' in 'simple_match::customization::pointer_getter<std::__1::variant<X, Y> >' [build] auto ptr = customization::pointer_getter<std::decay_t<T>>::template get_pointer<Class>(std::forward<T>(t));

Here is the code sample;

struct X { int _x; X(int x) : _x(x) {}; };
struct Y { int _y; Y(int y) : _y(y) {}; };

using XY = std::variant<X, Y>;

std::string eval(const XY& v) {
	using namespace simple_match;
	using namespace simple_match::placeholders;

	return match(v,
		some<X>(), [](auto&& x) { return "Found variant Y";},
		some<Y>(), [](auto&& y) { return "Found variant X";}
    );
}

void test_variant() {
	XY xy{ X(2) };
    const auto & eval(xy);
}

This code sample is based on the math_variant_t example in test.cpp only without the variant recursive wrapper and of course without Boost.

Could anyone please help ?
Am I using simple_match correctly ?

Many thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant