|
Boost : |
Subject: Re: [boost] [fusion] [intro] ADAPT_STRUCT extensions
From: Stefan Strasser (strasser_at_[hidden])
Date: 2010-08-15 13:01:39
Zitat von Joel de Guzman <joel_at_[hidden]>:
> class foo
> {
> public:
>
> int x() const;
> void x(int n);
> int y() const;
> void y(int n);
>
> private:
> // encapsulated
> };
>
> Now, adapt that class to fusion.
is the goal a (mutable) fusion sequence with value type int?
then there is no solution, as the class only exposes the value of its members.
if the goal is just any representation of the class in sequence form,
I'd suggest to make the (now transparent) proxy object visible to the
user.
that way even functors that require a reference to the value can be
applied to a class, by plugging in something like
template<...>
struct transform_property{
template<typename T>
void operator()(property<T> prop) const{
T tmp=prop.get();
base(tmp);
prop.set(tmp);
}
};
with property<> being the proxy object.
my case could then support sequences created using
ADAPT_CLASS/ADAPT_whatever similarily.
-Stefan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk