Reputation: 1198
I'm trying to generalize runtime attribute getter/setters for my classes with compile time declarations. I thought I could do something like this:
// header
class arguments {
public:
template <typename T, char const *NAME> void set_id(T const &id)
{
///..
set(NAME, id);
}
};
class test : public arguments {
public:
using set_alpha = arguments::set_id<double, "Alpha">;
};
// cpp
int main()
{
test obj;
obj.set_alpha(47.11);
return 0;
}
Visual Studio 2019 is giving my some error C2061: syntax error: identifier 'set_id'
. Is there a way to specify member functions like this with C++17 or what am I doing wrong here?
Thank you
Upvotes: 2
Views: 59