Merge branch 'master' into patch-1

This commit is contained in:
Sergey Chupov 2018-06-18 14:05:32 +03:00 committed by GitHub
commit 788fd9a1b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -182,4 +182,5 @@ YYYY/MM/DD, github id, Full name, email
2017/12/27, jkmar, Jakub Marciniszyn, marciniszyn.jk@gmail.com
2018/02/11, io7m, Mark Raynsford, code@io7m.com
2018/15/05, johnvanderholt, jan dillingh johnvanderholte@gmail.com
2018/14/06, scadgek, Sergey Chupov, scadgek@live.com
2018/06/14, scadgek, Sergey Chupov, scadgek@live.com
2018/06/16, EternalPhane, Zongyuan Zuo, eternalphane@gmail.com

View File

@ -11,6 +11,3 @@ Any::~Any()
{
delete _ptr;
}
Any::Base::~Base() {
}

View File

@ -100,7 +100,7 @@ struct ANTLR4CPP_PUBLIC Any
private:
struct Base {
virtual ~Base();
virtual ~Base() {};
virtual Base* clone() const = 0;
};
@ -112,10 +112,21 @@ private:
T value;
Base* clone() const {
return clone<>();
}
private:
template<int N = 0, typename std::enable_if<N == N && std::is_nothrow_copy_constructible<T>::value, int>::type = 0>
Base* clone() const {
return new Derived<T>(value);
}
template<int N = 0, typename std::enable_if<N == N && !std::is_nothrow_copy_constructible<T>::value, int>::type = 0>
Base* clone() const {
return nullptr;
}
};
Base* clone() const