|
Boost : |
Subject: Re: [boost] [Compute] array support
From: Kyle Lutz (kyle.r.lutz_at_[hidden])
Date: 2015-09-19 15:58:30
On Fri, Sep 18, 2015 at 7:05 AM, Fabian Bösch <boeschf_at_[hidden]> wrote:
> Hi,
>
> I've been using Boost.Compute for some tests in the last couple of days.
> So far, it has proven very useful and I came to like it quite a bit. One
> thing I would add to it, though, is support for arrays when adapting
> your own classes for OpenCl through the Macro
> BOOST_COMPUTE_ADAPT_STRUCT. A simple overload would do the trick in my
> opinion:
>
> namespace boost {
> namespace compute {
> namespace detail {
>
> template<class Struct, class T>
> inline std::string adapt_struct_insert_member(T Struct::*, const char
> *name)
> {
> std::stringstream s;
> s << " " << type_name<T>() << " " << name << ";\n";
> return s.str();
> }
>
> template<class Struct, class T, int N>
> inline std::string adapt_struct_insert_member(T (Struct::*)[N], const
> char *name)
> {
> std::stringstream s;
> s << " " << type_name<T>() << " " << name << "[" << N << "]" <<
> ";\n";
> return s.str();
> }
>
> } // end detail namespace
> } // end compute namespace
> } // end boost namespace
>
> Hope something along this lines can be added, thanks,
That should be doable, I've opened an issue for this:
https://github.com/boostorg/compute/issues/515.
-kyle
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk