Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 1999-11-28 10:58:04


Time to step back and look at call_traits<> from the standpoint of
the user rather than the implementor.

[The first couple of these paraphrase John]

1) Using call_traits<> should be no worse than existing practice
(const T&).

2) Boost should provide conservative defaults; uses can always tweek
the class for a particular machine.

3) Since 1) and 2) imply that the default for UDT's will be
pass-by-reference, there should be a way for the user to say that a
specific UDT should pass-by-value.

4) The call_traits<> interface should be kept as simple; this is
just an an efficiency helper, not a major library component.

Let's try to nail down the interface specification. How about:

template<typename T>
struct call_traits
{
    static const bool by_value;
    typedef T const type; // if by_value
    typedef const T& type; // if !by_value
};

How this is implemented is not part of the specification.

That leaves undecided how the user is to specify that a UDT should
pass by value. Either write a specialization for call_traits<> or
via type_traits<>, I guess are the choices.

Let's try to back off from discussion of implementation for a while,
and focus on specification. And we haven't talked at all about the
requirements for T, either.

--Beman
  


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