Boost logo

Boost Users :

From: Cromwell Enage (sponage_at_[hidden])
Date: 2007-11-16 21:22:21


--- Robert Dailey wrote:
> So far, this is all I've been able to come up with:
>
> #include <boost/mpl/map.hpp>
> #include <boost/mpl/at.hpp>
>
> namespace detail
> {
> template< unsigned int t_value >
> struct integral
> {
> static const unsigned int value = t_value;
> };
>
> typedef boost::mpl::map<
> boost::mpl::pair<float, integral<GL_FLOAT>
> >,
>
> boost::mpl::pair<double, integral<GL_DOUBLE>
> >
> > glTypeMap;
> };
>
> template< typename t_type >
> struct Vertex
> {
> static const unsigned int type =
> boost::mpl::at<detail::glTypeMap,
> t_type>::type::value;
> t_type x, y, z;
> };

Try this:

#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/map.hpp>
#include <boost/mpl/at.hpp>

namespace detail {
    using namespace boost;
    using namespace mpl;

    typedef map<
        pair<
            float
          , integral_c<unsigned int,GL_FLOAT>
>
      , pair<
            double
          , integral_c<unsigned int,GL_DOUBLE>
>
> glTypeMap;

    template <typename t_type>
    struct Vertex
    {
        static const unsigned int type =
            at<glTypeMap,t_type>::type::value;
        t_type x, y, z;
    };
} // namespace detail

                              HTH,
                              Cromwell D. Enage

      ____________________________________________________________________________________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/


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