Basically, given a template class like this:
template< class Value > class Holder { };
I would like to be able to discover the type Value
for a given Holder
class. I thought that I would be able to make a simple metafunction that takes a template template argument, like this:
template< template< class Value > class Holder > class GetValue
{
typedef Value Value;
};
And then extract out the Value
type like this:
GetValue< Holder< int > >::Value value;
But instead I just get an error message pointing to the metafunction declaration:
error: ‘Value’ does not name a type
Is there any way to accomplish this kind of thing? Thanks.
[EDIT] I also get the error messages:
error: type/value mismatch at argument 1 in template parameter list for ‘template<template<class Value> class Holder> class GetValue’
error: expected a class template, got ‘Holder<int>’
Which leads me to conclude that Phil Nash is right, you can't pass a class as a template template argument.