|
Boost Users : |
Subject: [Boost-users] selecting a type (tag) based on a runtime enum value
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-03-16 12:06:16
Hello,
I have a templated function Engine, that takes 3 template arguments,
these are tags T1, T2, T3, T4.
I have an
typedef enum { e1, e2, e3, e4 } E
to element ei corresponds the type Ti
...
const E e //
switch (e)
{
case e1:
Engine< Metafct1<T1>::type, Metafct2<T1>::type, Metafct3<T1>::type >::Process( .... ); break;
case e2:
Engine< Metafct1<T2>::type, Metafct2<T2>::type, Metafct3<T2>::type >::Process( .... ); break;
...
}
Is there a shorter way of writing this... For now I only have 4 in the enum, but I may have more later?
regards,
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