|
Boost : |
From: John Maddock (John_Maddock_at_[hidden])
Date: 2000-06-10 06:41:23
Dave,
>Can someone explain the existence of the following in call_traits.hpp, and
>how such code came to be accepted into a release library?
Good question, doesn't look good does it? Looks like we forgot to finish
this - in fact looking closer it's not clear how the array specialisation
should look (and most current compilers don't actually need the array
specialisation anyway), the most recent version (of several) was suggested
by Howard, but doesn't meet the constructability guarantees. Here are the
options:
Option 1: doesn't meet constructability guarentees, but ensures that
value_type is assignable:
template <typename T, std::size_t N>
struct call_traits<T [N]>
{
typedef T* const value_type; // hh was typedef T
value_type[N];
typedef T (&reference)[N]; // hh was typedef T*& reference;
typedef const T (&const_reference)[N]; // hh was typedef const T*&
const_reference;
typedef value_type param_type; // hh was typedef T* param_type;
};
Option 2: meets constructability guarentees but value_type is not
assignable:
template <typename T, std::size_t N>
struct call_traits<T [N]>
{
private:
typedef T array_type[N];
public:
typedef array_type& value_type;
typedef value_type reference;
typedef const array_type& const_reference;
typedef value_type param_type;
};
Thoughts?
- John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk