Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-11-04 13:07:49


Joel de Guzman <joel_at_[hidden]> writes:

> Comments, feedback very welcome!

> Supported operators

Style tip: every section should have some introductory text before its
first subsection. Every subsection should have at least one sibling.

> Unary operators
>
> prefix: ~, !, -, +, ++, --, & (reference), * (dereference)
> postfix: ++, --
>
> Binary operators
>
> =, [], +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=
> +, -, *, /, %, &, |, ^, <<, >>
> ==, !=, <, >, <=, >=
> &&, ||, ->*
>
> Ternary operator
>
> if_else(c, a, b)
>
> The ternary operator deserves special mention. Since C++ does not
> allow us to overload the conditional expression: c ? a : b, the
> if_else pseudo function is provided for this purpose. The behavior
> is identical, albeit in a lazy manner.

Does it deserve special support? Why not just use

     if_(c)[a].else[b]

?
  
> Member pointer operator
>
> a->*member_object_pointer
> a->*member_function_pointer
>
> The left hand side of the member pointer operator must be an actor
> returning a pointer type. The right hand side of the member pointer
> operator may be either a pointer to member object or pointer to
> member function.
>
>
> If the right hand side is a member object pointer, the result is a
> composite providing lazy access to that member.

  "an actor that, when invoked, returns a reference to that member."

> For example:
>
> struct A
> {
> int member;
> };
>
> A* a = new A;
> ...
>
> (arg1->*&A::member)(a); // returns member a->member
>
> If the right hand side is a member function pointer, the result is a
> delayed function call. The arguments to this call are then bound to
> the returned composite.

The wording is confusing. "Delayed function call" has not been
defined. Why not just say that "the result is an actor that, when
invoked, calls the specified member function?" Is that inaccurate?

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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk