Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Explicit instantiation of a mpl::vector of types

Reply
Thread Tools

Explicit instantiation of a mpl::vector of types

 
 
Aaron Graham
Guest
Posts: n/a
 
      04-03-2009
template <typename T> struct foo { ... };
typedef boost::mpl::vector<A, B, C, D, E, F> my_types;

I would like to explicitly instantiate foo<T> for all types in
my_types. Those are all the types that foo<T> will ever be used with,
and the surrounding metaprogramming is large and complex enough that I
don't want to put it all in a header file.

So I want to metaprogram the equivalent of:

template class foo<A>;
template class foo<B>;
template class foo<C>;
....etc...

The current solution I have is a function that calls mpl::for_each on
the vector of types, but that actually generates unnecessary code that
never needs to be called, which I find rather ugly.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Explicit instantiation of STL vector demands explicit instantiation of all the templates it using internally. krunalbauskar@gmail.com C++ 1 12-25-2006 03:51 PM
Help with explicit instantiation E. Robert Tisdale C++ 3 09-18-2004 08:06 AM
Explicit template instantiation from template function doesn't compile? Fernando Cuenca C++ 4 09-06-2004 04:06 PM
problem with explicit template instantiation in Visual C++ 6.0 . C. Carbonera C++ 4 02-05-2004 05:05 PM
Re: std::map explicit instantiation Rolf Magnus C++ 0 07-23-2003 02:07 PM



Advertisments