Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-08-20 07:52:53


At 01:38 AM 8/20/2002, Gennadiy Rozental wrote:

>> Error E2285 c:\boost\site\libs/tuple/test\io_test.cpp 97: Could not
find
>> match for 'test_toolbox::detail::test_and_continue_impl(istream,const
>> test_toolbox::detail::wrapstrstream,char *,int)' in function
>> test_main(int,char * *)
>
>It's still unresolved. I am not a standart lower, so I would like to hear
                                    ^^^^^^^^^^^^^^
standards lawyer:-?

>an input from boosters. We have 4 choises:
>1. Do nothing. Users need to change tested expression to clarify what
they
>need.
>2. Change to !!(predicate). This in fact test operator!().
>3. ((bool)predicate). This in fact may test wrong thing. I presume it
>should
>try to call operator bool().
>4. ( predicate ? true : false ). Someone told it could also test a wrong
>thing. Though it looks like a boolean context to me.

Here is the context:

#define BOOST_CHECK(predicate) \
     boost::test_toolbox::detail::test_and_continue_impl((predicate), \
         boost::test_toolbox::detail::wrapstrstream() << #predicate,
__FILE__, __LINE__)

test_and_continue_impl has a couple of overloads, so if the user writing
the predicate relied on a conversion, the result may be ambiguous.

Option 5 would be to rename the non-bool overload. If that isn't possible,
option 4 (which should be "(predicate) ? true : false") looks better to me,
although I'm not a language expert either.

--Beman


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