|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2006-03-22 07:02:40
"Markus Schöpflin" wrote
> Richard Corden wrote:
>
> [...]
>
>> Can I ask what is the purpose of adding parenthesis to the qualified name?
>>
>> ADL should not take place for the qualified name? Do some compilers get
>> this wrong?
>>
>> Is there another reason?
>
> See http://www.boost.org/more/lib_guide.htm#Guidelines.
FYI I have discovered that in my useage of min the advice doesnt seem to help,
my use being default construction of a temporary of type named max or min:
>From one of my test files I currently ended up using the obvious workaround:
// here boost::pqs::time::min is a typedef for a quantity of time in minutes
#if ! defined (min)
BOOST_CHECK(units_str( boost::pqs::time::min()) == "min");
#else
//use of min() looks like the macro so just create a variable
boost::pqs::time::min min;
BOOST_CHECK(units_str(min) == "min");
#endif
The only other option would seem to be to "save" the body of the min macro
undefine it and then redefine it later, IOW not possible in practise AFAIK.
If anyone has ideas what the preferred option is in this situation I would be
interested to know?
---------- Boost.Inspect and min max
Inspect reports the above as a violation of boost guidelines of course, though I
have attended to them. I dont know quite what else to do about it as the names
are the recommended SI names. Ideally I would like to tell inspect to disable
this "violation" here as I've attended to it etc.
Inspect also reports use of min in comments as in the 2nd /3rd line below as a
violation:
#if defined (min)
// some compilers use a min() macro
// this causes a failure of useage of e.g my_stuff::min()
// for other purposes
#define DONT_USE_MIN_LIKE_CONSTRUCT
#endif
Finally Boost.Inspect reports use in strings as a violation:
std::string my_min_str = "just a min()";
I will try to come up with a patch for Boost.Inspect.
... Meanwhile FYI.
regards
Andy Little
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk