fix build

This commit is contained in:
Nikolai Kochetov 2018-03-19 23:27:17 +03:00
parent 4d8f5f9c34
commit 51860191eb

View File

@ -227,12 +227,13 @@ private:
Derived * derived() { return static_cast<Derived *>(this); } Derived * derived() { return static_cast<Derived *>(this); }
const Derived * derived() const { return static_cast<const Derived *>(this); } const Derived * derived() const { return static_cast<const Derived *>(this); }
template<typename Class, typename... Args> template<typename Class, typename Res, typename... Args>
struct HasCreateImmutable<Args...> { struct HasCreateImmutable
{
private: private:
template<typename T> template<typename T>
static constexpr auto check(T *) -> typename std::is_same< static constexpr auto check(T *) -> typename std::is_same<
decltype( std::declval<T>().createImmutable( std::declval<Args>()... ) ), Ptr decltype( std::declval<T>().createImmutable( std::declval<Args>()... ) ), Res
>::type; >::type;
template<typename> template<typename>
@ -251,7 +252,7 @@ public:
template <typename... Args> template <typename... Args>
static auto create(Args &&... args) static auto create(Args &&... args)
{ {
if constexpr (HasCreateImmutable<Derived, args ...>) if constexpr (HasCreateImmutable<Derived, Ptr, Args ...>::value)
return Derived::createImmutable(std::forward<Args>(args)...); return Derived::createImmutable(std::forward<Args>(args)...);
else else
return MutablePtr(new Derived(std::forward<Args>(args)...)); return MutablePtr(new Derived(std::forward<Args>(args)...));