joboccara / NamedType

Implementation of strong types in C++
MIT License
769 stars 84 forks source link

Windows MSVC Compile error with std::is_reference #4

Closed Guillaume227 closed 6 years ago

Guillaume227 commented 6 years ago

Hi Jonathan, [big fan of fluent c++, got to know you on cppcast]

I get this compile error with MSVC (Visual Studio 2017 15.3). That code is fine on gcc and clang.

/NamedType/named_type.hpp(26): error C2512: 'std::isreference<T>': no appropriate default constructor available

explicit NamedTypeImpl(T&& value, typename std::enable_if<!std::is_reference<T_>{}, std::nullptr_t>::type = nullptr) while the following works (and to me looks more idiomatic): explicit NamedTypeImpl(T&& value, typename std::enable_if < !std::is_reference<T_>::value, std::nullptr_t > ::type = nullptr) : value_(std::move(value)) {}

Diff is just std::isreference<T>{} becoming std::isreference<T>::value

Would you accept a PR for that ?

joboccara commented 6 years ago

Yes, absolutely. Sorry for the late reply, only saw your issue now. Thanks!

Guillaume227 commented 6 years ago

PR submitted: https://github.com/joboccara/NamedType/pull/5