|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-01-04 15:07:39
"Howard Hinnant" <hinnant_at_[hidden]> wrote in message
news:99BAA38A-5E89-11D9-B3F9-003065D18932_at_twcny.rr.com...
| Rambling a little bit today... I set up a little test:
| This prints out (on my system):
|
| A<int>
| A<int>
| A<const int *>
| A<int *>
| A<void (*)()>
| A<const char *>
| A<const wchar_t *>
| A<int>
| A<volatile int>
| A<int[3]>
| A<int[4]>
| A<void ()>
| A<char[7]>
| A<wchar_t[5]>
I like this behavior.
| Using a decay that supports function->function pointer, and one that
| strips top level cv-qualifiers off of non-arrays, and non-functions,
| and using John's overload strategy:
| I can get the original behavior:
|
| A<int>
| A<int>
| A<const int *>
| A<int *>
| A<void (*)()>
| A<const char *>
| A<const wchar_t *>
| You really need four make_pair overloads to cover everything:
|
| make_pair( const F& f, const S& s );
| make_pair( const F& f, S& s );
| make_pair( F& f, const S& s );
| make_pair( F& f, S& s );
|
| Now you should get the correct:
And this is really bad. I can't provide all these overloads in boost.assign
for
2-5 arguements, say.
For me the parameter type must be const T& and in this setting I particulilar
need to
handle string literals. Function pointers would be nice to handle too (as they
currently are),
but I feel normal non-const array decay is much less used. So I think the
imperfect
version in boost and C++03 should just add the const to arrays.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk