Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-07-15 11:58:05


AMDG

Joel Falcou wrote:
> I'm compiling some code on the Cell processor main CPU using its
> dedicated gcc. The code is calling mpl::apply1 onto a custom
> meta-function.
>
> <snip>
>
> I know that "officially" boost is not supported on this kidn of
> platform but most of my code compiles and works flawlessly except for
> this. Any hints on what to do to fix this even locally ?

Does mpl::apply work for namespace scope metafunctions?
You can try moving the metafunction outside the class and typedefing
it. Alternately, you can try quote:

#include <boost/mpl/bool.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/quote.hpp>

using namespace boost;

struct none {};

template<class T>
struct scalar_mode_base {
    template<class Type>
    struct apply : mpl::if_< is_same<T,none>, Type, T> {};
};

template<class T> struct scalar_mode
  {
    typedef mpl::false_ status;

    //template<class Type>
    //struct base_impl : mpl::if_< is_same<T,none>, Type, T> {};
    //typedef mpl::quote1<base_impl> base;

    typedef scalar_mode_base<T> base;
};

typedef mpl::apply1< scalar_mode<none>::base, float>::type type;

In Christ,
Steven Watanabe


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