Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-10-22 10:13:04


----- Original Message -----
From: "Jaakko Jarvi" <jajarvi_at_[hidden]>
To: <boost_at_[hidden]>
Cc: <fernando_cacciola_at_[hidden]>
Sent: Thursday, October 17, 2002 11:52 PM
Subject: Re: tuples and Borland precompiled headers.

Hi Jakko,

Thank you for responding, and sorry for the delay...

>[snipped]
>Did this fix come up in earlier discussions:
>
>1. define ignore as some function that has some special type
>E.g.:
>
>namespace detail {
>
> class ignore_helper {};
> typedef void (ignore_type) (ignore_helper);
>}
>
>void ignore(detail::ignore_helper) {}
>
>
>2. Make tie functions recognize this and create a tuple with a
>swallow_assign or some other type with an empty assignment.
>(Some traits class can detect the type detail::ignore_type.)
>
>It's easy to do for tuple_basic_no_partial_spec.hpp (no changes to tie
>funcs needed).
>In addition to the code above, this specialization to
>assign_to_pointee should do the trick.
>Note that I can't test with Borland, but with gcc it seems to work.
>
>namespace detail {
> template<>
> struct assign_to_pointee<detail::ignore_type>
> {
> public:
> explicit assign_to_pointee(detail::ignore_type* p) {}
>
> template<typename Other>
> assign_to_pointee& operator=(const Other& other)
> {
> return *this;
> }
> };
>}
>
>This would have the benefit, that you wouldn't have to fiddle with the
>#define BOOST_TUPLE_EXTERN macros.
>
>To sum up:
>
>1. Would this work with borland ?

I like your proposal better, much better :-) But it doesn't work with
bcc551!

The probem is that this TOY compiler cannot compile something as simple as:

void bar() {}
template<typename T1> void foo( T1& ) {}
int main() { foo(bar); }

It says: E2285 Could not find a match for 'foo<T1>(void(*)())'

It works if the argument is not a reference:

template<typename T1> void foo( T1 ) {}

but this is not an option, and trying to switch between T/T& via
metaprogramming does not seem to work either.. at least not with these naive
constructs:

template<typename T> struct get_param
{ typedef T& type ; } ;

typedef void(*bar_type)();

template<>
struct get_param<bar_type>
{
  typedef bar_type type ;
} ;

template<typename T1>
void foo( typename get_param<T1>::type t1 )
{
}

>2. Does the compilers that currently have trouble with ignore use
>tuple_basic_no_partial_spec.hpp or tuple_basic.hpp or both.
>(If only the former, the fix would be easier).
>
Borland uses tuple_basic.hpp.

>3. Is this worth the trouble or should we just go with Fernando's patch?
>
I prefer to insit a little bit more on your solution... I don't really like
having to fiddle with marcro switches.

>When we reach a resolution,
>Fernando, could you provide a real patch, that can be run with unix patch?
>That way I don't introduce errors as I don't have the borland compiler to
>test with.
>
Sure... If you just tell me how to do that :-) (using 'diff' in a specified
way perhaps?)

>Cheers, Jaakko
>

Cheers,

Fernando Cacciola

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.microsoft.com/es


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