|
Boost Users : |
Subject: Re: [Boost-users] Using an mpl sepquence as a template parameter
From: Gabriel Redner (gredner_at_[hidden])
Date: 2011-11-14 17:00:01
Several times I've done something like this:
namespace detail {
struct none {};
template <typename TSeq>
struct strip_none
{
typedef typename boost::mpl::remove<TSeq, none>::type type;
};
} // namespace detail
template <
typename T0,
typename T1 = detail::none, typename T2 = detail::none,
typename T3 = detail::none, typename T4 = detail::none,
typename T5 = detail::none, typename T6 = detail::none>
class some_class
{
typedef boost::mpl::vector<T0, T1, T2, T3, T4, T5, T6> raw_types;
typedef typename detail::strip_none<raw_types>::type types;
...
};
Presumably some simple PP magic could make this prettier.
-Gabe
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