Boost logo

Boost Users :

From: Oliver.Kowalke_at_[hidden]
Date: 2005-10-27 08:32:41


Hello,
is it possible to store templates instead of complete types in
boost::mpl::vector?
I want to compose a class out of templates:

template<
        typename B,
        typename E,
        typename Comp
>
struct Scattered;
                
template<
        typename B,
        typename E,
        typename Comp

>
struct Scattered
:
public mpl::deref< B >::type< Comp >, // <<== inherit from the
template, Comp == Special
public Scattered<
                typename mpl::next< B >::type,
                E,
                Comp
>
{};
                
template< typename E, typename Comp >
struct Scattered< E, E, Comp >
{};

template< typename Sequence, typename Comp >
struct InheritScattered
:
public detail::Scattered<
                typename mpl::begin< Sequence >::type,
                typename mpl::end< Sequence >::type,
                Comp
>
{};

template< typename D >
class ReadN
{
        void readn()
        {
                D & d = static_cast< D & >( * this);
                d.some_function();
                ....
}
};

template< typename D >
class WriteN
{
        void writen()
        {
                D & d = static_cast< D & >( * this);
                ...
}
};

temlate< typename TL >
struct Basic
{};

typedef BaiscX< mpl::vector< ReadN, WriteN > > Special; // <<==
composing SpecialX (inherit from ReadN which is a template)

Special s;

s.readn();
s.writen();


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net