lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [PATCH] Fix value_cast defect shown by the unit test


From: Greg Chicares
Subject: Re: [lmi] [PATCH] Fix value_cast defect shown by the unit test
Date: Mon, 9 Jan 2017 11:20:22 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.5.1

On 2017-01-08 18:03, Vadim Zeitlin wrote:
> On Sun, 8 Jan 2017 17:50:08 +0000 Greg Chicares <address@hidden> wrote:
> 
> GC> Switching from boost to std is always good, especially when it removes
> GC> a defect. I was tempted to replace type_traits globally throughout lmi,
[...]
> replacing one with the other is
> an almost completely mechanical task.

It seems straightforward to replace is_base_and_derived with is_base_of,
because that's what happened when it was standardized:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1424.htm
| Renamed is_base_and_derived to is_base_of: this change has caused a
| fair amout of controversy, with many boosters prefering the more
| verbose original name.

But I was surprised to see that 'multidimgrid_safe.hpp' uses is_base_of
already, while no other file in lmi does. The way it's used there

    BOOST_STATIC_ASSERT(
        (  boost::is_base_of<MultiDimAxisAny, BaseAxisType>::value
        || boost::is_same<MultiDimAxisAny, BaseAxisType>::value
        ));

looks the same as the way we use is_base_and_derived elsewhere. Trying
to read the boost-1.33.1 headers in third_party/include is pretty
difficult, so I'll just assume these things are synonymous.

This article:

http://stackoverflow.com/questions/28665645/why-is-stdis-base-oft-t-true-when-t-is-a-class-type-but-false-when-t-is-a/28666177#28666177

gives some interesting background, and leads me to conclude that we
no longer need to test is_same along with is_base_of. The standard
[20.9.6/2] says of is_base_of:

| Base is a base class of Derived without regard to cv-qualifiers
| or Base and Derived are not unions and name the same class type
| without regard to cv-qualifiers

so I think I'll remove the pleonastic is_same in a separate commit.
(Howard Hinnant's message cited above explains the "not unions" part.)

BTW, every time I do 'apt-get upgrade', I seem to get a new 'icedove'
regression. The stackoverflow URL pasted above as a single line now
shows up as two separate lines

http://stackoverflow.com/questions/28665645/why-is-stdis-base-oft-t-true-when-t-is-a-class-type-but-false-when-t-
is-a/28666177#28666177

as I compose this message, even though I have mailnews.wraplength
set to zero as mozilla recommends. I fear it will similarly be
split in the html archives. Apparently stackoverflow accepts
truncated URLs, even this:
  stackoverflow.com/questions/28665645/why-is
but in other circumstances this new wrapping will be harmful.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]