dd #13

Closed
jasder wants to merge 34 commits from master into align-js-runtime-with-java-runtime
2 changed files with 14 additions and 3 deletions
Showing only changes of commit 0daa97a5f0 - Show all commits

View File

@ -244,3 +244,4 @@ YYYY/MM/DD, github id, Full name, email
2020/04/07, deniskyashif, Denis Kyashif, denis.kyashif@gmail.com
2020/04/30, TristonianJones, Tristan Swadell, tswadell@google.com
2020/05/31, d-markey, David Markey, dmarkey@free.fr
2020/06/15, mattpaletta, Matthew Paletta, mattpaletta@gmail.com

View File

@ -65,16 +65,26 @@ struct ANTLR4CPP_PUBLIC Any
return derived->value;
}
template<class U>
template<class U, typename std::enable_if<std::is_copy_constructible<U>::value || std::is_copy_assignable<U>::value>::value>
operator U() {
return as<StorageType<U>>();
}
template<class U>
template<class U, typename std::enable_if<(!std::is_copy_constructible<U>::value && !std::is_copy_assignable<U>::value) && (std::is_move_constructible<U>::value || std::is_move_assignable<U>::value)>::value>
operator U() {
return std::move(as<StorageType<U>>());
}
template<class U, typename std::enable_if<std::is_copy_constructible<U>::value || std::is_copy_assignable<U>::value>::value>
operator const U() const {
return as<const StorageType<U>>();
}
template<class U, typename std::enable_if<!(!std::is_copy_constructible<U>::value && !std::is_copy_assignable<U>::value) && (std::is_move_constructible<U>::value || std::is_move_assignable<U>::value)>::value>
operator const U() const {
return std::move(as<const StorageType<U>>());
}
Any& operator = (const Any& a) {
if (_ptr == a._ptr)
return *this;
@ -99,7 +109,7 @@ struct ANTLR4CPP_PUBLIC Any
virtual ~Any();
virtual bool equals(Any other) const {
virtual bool equals(const Any& other) const {
return _ptr == other._ptr;
}