joboccara / NamedType

Implementation of strong types in C++
MIT License
766 stars 85 forks source link

can't move StrongType with MethodCallable skill. #39

Closed ralwing closed 4 years ago

ralwing commented 4 years ago

A small piece of code which doesn't compile due to an error:

'operator->' declared as a pointer to a reference of type 'std::basic_string<char, std::char_traits<char>, std::allocator<char> > &'    underlying_functionalities.hpp  115
using StrongA = fluent::NamedType<std::string, struct StrongATag, fluent::MethodCallable>;

struct StringValue
{
    StringValue(StrongA name);
    StrongA id;
};

StringValue::StringValue(StrongA name)
    : id{std::move(name)} {}
ralwing commented 4 years ago

Fixed here: https://github.com/travnick/NamedType/commit/54ce8680980f0cfa33d282f6ae481eb3d387f586