[CMake] gcc and concept-checks
Rodolfo Lima
rodolfo at rodsoft.org
Thu May 15 20:46:27 EDT 2008
dizzy escreveu:
> Seems CMake is violating ISO C++ then. You may not instantiate standard
> library templates of incomplete types (for example, even "struct A {
> std::auto_ptr<A> a; };" is invalid, C++0x will have an exception to that for
> shared_ptr<>, but for the standard containers that surely is the rule).
It's not like that. You can instantiate a template with a incomplete
type as long as the template instantiation doesn't need the type's
definition, which is the case of shared_ptr (because of its type hiding
technique), but not with auto_ptr.
Example:
struct S;
template <class T> class A
{
T *ptr;
};
template <class T> class B
{
typedef typename T::value type;
};
A<S> a; // compiles fine
B<S> b; // error: invalid use of incomplete type 'struct S'
Regards,
rod
PS: sorry for being off-topic for this list
More information about the CMake
mailing list