Ref<> objects must be nested by reference because they potentially store a temporary object

(transplanted from 6719e56b5bfe9ae4badc9a6e894c5824f663d62e
)
This commit is contained in:
Gael Guennebaud 2013-08-11 17:52:43 +02:00
parent 47a7de7b53
commit b56348046f
2 changed files with 5 additions and 4 deletions

View File

@ -94,7 +94,8 @@ struct traits<Ref<_PlainObjectType, _Options, _StrideType> >
typedef _PlainObjectType PlainObjectType; typedef _PlainObjectType PlainObjectType;
typedef _StrideType StrideType; typedef _StrideType StrideType;
enum { enum {
Options = _Options Options = _Options,
Flags = traits<Map<_PlainObjectType, _Options, _StrideType> >::Flags | NestByRefBit
}; };
template<typename Derived> struct match { template<typename Derived> struct match {
@ -111,7 +112,7 @@ struct traits<Ref<_PlainObjectType, _Options, _StrideType> >
}; };
typedef typename internal::conditional<MatchAtCompileTime,internal::true_type,internal::false_type>::type type; typedef typename internal::conditional<MatchAtCompileTime,internal::true_type,internal::false_type>::type type;
}; };
}; };
template<typename Derived> template<typename Derived>

View File

@ -14,9 +14,9 @@
static int nb_temporaries; static int nb_temporaries;
inline void on_temporary_creation(int size) { inline void on_temporary_creation(int) {
// here's a great place to set a breakpoint when debugging failures in this test! // here's a great place to set a breakpoint when debugging failures in this test!
if(size!=0) nb_temporaries++; nb_temporaries++;
} }