Boost logo

Boost Users :

From: Russell L. Carter (rcarter_at_[hidden])
Date: 2008-01-23 14:29:22


Doh!

Thanks.

Steven Watanabe wrote:
> AMDG
>
> Russell L. Carter wrote:
>> then I
>> get "void value not ignored as it ought to be" at the line:
>> "FooFunc ff = put.getFooFunc();"
>>
>> I get the same thing if I try: FooFunc ff = MHBase<Put>::fooFO(put);
>>
>> Here's the code:
>>
>> #include <boost/function.hpp>
>> #include <iostream>
>>
>> class MHBAccessor {
>> template<class> friend class MHBase;
>> template<class Derived>
>> static int foo(Derived& derived, int i) { return derived.foo_(i); }
>> };
>> typedef boost::function<int (int)> FooFunc;
>>
>> template <class Derived>
>> struct MHBase {
>> Derived& derived() { return static_cast<Derived&>(*this); }
>>
>> int foo(int i) { return MHBAccessor::foo(this->derived(), i); }
>>
>> struct fooFO {
>> fooFO(MHBase<Derived>& mhb) : mhb_(mhb) {}
>> void operator()(int i) { mhb_.foo(i); }
>>
>
> This returns void. FooFunc expects int.
> try
>
> int operator()(int i) { return(mhb_.foo(i)); }
>
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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