Boost logo

Boost Users :

From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2006-11-29 17:48:50


I'm kind of loosing faith that this list ever responds to questions
but here goes anyway.

I've narrowed a problem down to this:

#include <iostream>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>

struct test_b
{
  test_b() { std::cerr << "test_b::test_b()\n"; }
  test_b(test_b const&) { std::cerr << "test_b::test_b(test_b const&)\n"; }
  virtual int f() = 0; //{ return 5; }

};

struct test_d : test_b
{
  test_d() : test_b() { std::cerr << "test_d::test_d()\n"; }
  test_d(test_d const& d) : test_b(d) { std::cerr <<
"test_d::test_d(test_d const&)\n"; }
  int f() { return 5; }
};

int main(void)
{
  namespace l = boost::lambda;

  test_b & td = test_d();

  std::cerr << "Value: " <<
    (l::bind(&test_b::f, l::_1))(td) << "\n";

  int x; std::cin >> x;
}

Compiler result: cannot instantiate abstract class test_b.

Because lambda doesn't seem to be able to handle smart pointers at all
I have been trying to come up with a way to pass the dereferenced
result into the function call. Nothing is working. In the end lambda
must be able to handle the above in order to make this work. If
lambda cannot handle this simple case I just don't see how it can be
any use.

The full compiler output follows:

1>c:\boost\include\boost-1_33_1\boost\tuple\detail\tuple_basic.hpp(419)
: error C2259: 'test_b' : cannot instantiate abstract class
1> due to following members:
1> 'int test_b::f(void)' : is abstract
1> c:\documents and settings\nroberts\my documents\visual
studio 2005\projects\playground\playground\playground.cpp(14) : see
declaration of 'test_b::f'
1> c:\boost\include\boost-1_33_1\boost\tuple\detail\tuple_basic.hpp(329)
: see reference to class template instantiation
'boost::tuples::cons<HT,TT>' being compiled
1> with
1> [
1> HT=test_b,
1> TT=boost::lambda::detail::deduce_non_ref_argument_types_<boost::tuples::cons<const
boost::lambda::lambda_functor<boost::lambda::placeholder<1>>,boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::type>::tail_type,boost::tuples::tuple<test_b
&,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>>::type
1> ]
1> c:\boost\include\boost-1_33_1\boost\lambda\detail\lambda_functor_base.hpp(151)
: see reference to class template instantiation
'boost::tuples::cons<HT,TT>' being compiled
1> with
1> [
1> HT=int (__thiscall test_b::* const )(void),
1> TT=boost::tuples::cons<test_b,boost::lambda::detail::deduce_non_ref_argument_types_<boost::tuples::cons<const
boost::lambda::lambda_functor<boost::lambda::placeholder<1>>,boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::type>::tail_type,boost::tuples::tuple<test_b
&,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>>::type>
1> ]
1> c:\boost\include\boost-1_33_1\boost\lambda\detail\lambda_functor_base.hpp(228)
: see reference to class template instantiation
'boost::lambda::detail::has_null_type<Tuple>' being compiled
1> with
1> [
1> Tuple=boost::tuples::cons<int (__thiscall test_b::*
const )(void),boost::tuples::cons<test_b,boost::lambda::detail::deduce_non_ref_argument_types_<boost::tuples::cons<const
boost::lambda::lambda_functor<boost::lambda::placeholder<1>>,boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::type>::tail_type,boost::tuples::tuple<test_b
&,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>>::type>>
1> ]
1> c:\boost\include\boost-1_33_1\boost\lambda\detail\lambda_functor_base.hpp(398)
: see reference to class template instantiation
'boost::lambda::detail::deduce_non_ref_argument_types<Args,SigArgs>'
being compiled
1> with
1> [
1> Args=boost::tuples::tuple<int (__thiscall test_b::*
const )(void),const
boost::lambda::lambda_functor<boost::lambda::placeholder<1>>,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type>,
1> SigArgs=boost::tuples::tuple<test_b
&,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>
1> ]
1> c:\documents and settings\nroberts\my documents\visual
studio 2005\projects\playground\playground\playground.cpp(32) : see
reference to class template instantiation
'boost::lambda::lambda_functor_base<Act,Args>::sig<SigArgs>' being
compiled
1> with
1> [
1> Act=boost::lambda::action<2,boost::lambda::function_action<2>>,
1> Args=boost::tuples::tuple<int (__thiscall test_b::*
const )(void),const
boost::lambda::lambda_functor<boost::lambda::placeholder<1>>,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type,boost::lambda::detail::bind_traits<boost::tuples::null_type>::type>,
1> SigArgs=boost::tuples::tuple<test_b
&,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>
1> ]


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