Re: [boost] Re: MPL::lambda on MSVC

2003-03-30 Thread David Abrahams
Jaap Suter [EMAIL PROTECTED] writes:

 The error occurs on the line with the boost static constant.

 Never mind that, I changed the code after I wrote the message.

 Here's the code in hopefully better formatting.

Looks to me like this code has the exact same problem.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


RE: [boost] Re: MPL Lambda on MSVC 7

2003-01-12 Thread Aleksey Gurtovoy
Jaap Suter wrote:
 So I tried to come up with the actual smallest example that 
 doesn't compile, even
 with the LAMBDA_SUPPORT macro. It looks as follows:
 
 template class T 
 struct meta_fun_1
 {
 typedef mpl::integral_c typename T::value_type, 0  type;
 BOOST_MPL_AUX_LAMBDA_SUPPORT( 1, meta_fun_1, (T) )
 };
 
 template class List, class T 
 struct meta_fun_2
 {
 typedef typename mpl::fold List,
 mpl::integral_c size_t, 0 ,
 meta_fun_1 mpl::_1 
 ::type type;
 };
 
 The problem lies in the fact that I try to use a dependent type in
 meta_fun_1. 

Yep, to be concrete, 'T::value_type'. Please see the following posts for an
explanation of the shortcoming, as well as for a technique to work around
it:

http://lists.boost.org/MailArchives/boost/msg39915.php (the relevant part
starts from Well, having said that... paragraph)
http://lists.boost.org/MailArchives/boost/msg39930.php (further explanation)


 I have pasted the full compiler error at the bottom of the
 message (it's rather long). The first few lines say:
 
 'value_type' : is not a member of 'boost::mpl::argN'
 with
 [
 N=1
 ]
 snip
 e:\library\boost_1_29_0\boost\type_traits\is_convertible.hpp(61) : see
 reference to class template instantiation 'test::meta_fun_1T' being
 compiled
 with
 [
 T=boost::mpl::_1
 ]
 
 Any suggestions? I can work-around it by using plain integers 
 instead of ::value_type, but it's not as elegant.

template class T 
struct meta_fun_1_impl
{
typedef mpl::integral_c typename T::value_type, 0  type;
};

template class T 
struct meta_fun_1
: mpl::if_
  mpl::is_placeholderT
, mpl::identityT
, meta_fun_1_implT
::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT( 1, meta_fun_1, (T) )
};

Or, if it's an internal/helper metafunction, just re-write it as a
metafunction class and, if you need to bind parameters to it - well, just
use 'bind':

typedef fold types, int_c0, bindtenary_meta_fun_class, _1 ,_2, int
::type res;

A.
___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



RE: [boost] Re: [MPL Lambda]

2002-11-22 Thread Aleksey Gurtovoy
David B. Held wrote:
  For your own metafunctions, you have to intrude them a 
  little bit, but otherwise it works as well:
 
  template typename T  struct f
  {
  typedef T type;
  BOOST_MPL_AUX_LAMBDA_SUPPORT(1,f,(T)) // here
  };
  [...]
 
 I assume it's safe to have this stuff in even for compilers 
 that don't need it? 

Yes.

 If I recall, it gets evaluated to nothing on conforming platforms? 

Yes.

 Also, I assume the first argument is the arity, and the last argument
 is a parenthesized list of the template parameters?

Exactly!

Aleksey
___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



Re: [boost] Re: MPL lambda

2002-11-15 Thread Dirk Gerrits
Mat Marcus wrote:


Scatter hierarchies can be achieved by using inherit_linearly together
with mpl::inherit. See the second example that Aleksey cited *is* an
example of a scatter hierarchy.


Forgive me, I hadn't realized this. That's just too cool! :) Thanks.

Regards,
Dirk Gerrits

___
Unsubscribe  other changes: http://lists.boost.org/mailman/listinfo.cgi/boost