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

Basic Example doesn't compile on MSVC '17 #206

Open
collinschupman opened this issue Jul 16, 2024 · 3 comments
Open

Basic Example doesn't compile on MSVC '17 #206

collinschupman opened this issue Jul 16, 2024 · 3 comments

Comments

@collinschupman
Copy link

I'm trying to compile a basic example, very close to what's presented in the examples folder on Windows w/ MSVC '17:

struct model
{
	int value = 0;
};

struct increment_action {};
struct decrement_action {};
struct reset_action { 
	int new_value = 0;
};

using action = std::variant<increment_action, decrement_action, reset_action>;

auto store = lager::make_store<action >(
       model{}, lager::with_manual_event_loop{});

This basic store init fails with error:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	C3200	'lager::detail::reader_node<T>': invalid template argument for template parameter 'Base', expected a class template	redacted	redacted\lib\lager\store.hpp	40		

I'm not entirely sure what the error is but store_node_base seems to have issue deducing the types it needs correctly.

@TheCoconutChef
Copy link
Contributor

TheCoconutChef commented Jul 17, 2024

I don't think this is a MSVC issue. You don't have an update function.

Try adding:

model update(model m, action a) { return m; }

Edit

Note that, as far as I can tell, there isn't necessarily a location in the lager doc that specifies explicitly that, by default, the make_store function expects to see an update function of an appropriate signature in order to work. However, it does show an example of the with_reducer enhancer here. This latter enhancer allow for more flexibility in the definition of your update function. In particular, it can be a class.

@collinschupman
Copy link
Author

@TheCoconutChef I forgot to add that code in my original post but I did have that update function. I just tested again with the update function and confirmed I am getting the same error. I read on another post people having better luck with C++20 so I switched to that and am now facing the same issue described here: #126 (comment)

@arximboldi
Copy link
Owner

I can't use MSVC myself, but contributions fixing these issues more than welcome!

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

No branches or pull requests

3 participants