[type_traits] Proposal: same_xxx
Hi, Recently I found some use for a tool adding const to a type if some other type is const. My use case was something like this: typename const_conformant < Range, typename boost::range_value<Range>::type
::type ...
I'm guessing that such use cases are quite common, not only for const
but also other qualifiers.
Do you think that a family of traits adding or removing qualifiers based
on the qualifiers of some other type could be a useful addon to the
TypeTraits?
E.g.:
same_const
Adam Wulkiewicz wrote:
Hi,
Recently I found some use for a tool adding const to a type if some other type is const.
...
same_cv
That's usually called copy_cv, and Google finds https://svn.boost.org/trac/boost/ticket/3970 and http://www.boost.org/doc/libs/master/boost/log/detail/copy_cv.hpp The rest of the traits don't seem particularly popular.
On Sunday 08 June 2014 16:08:07 Peter Dimov wrote:
Adam Wulkiewicz wrote:
Hi,
Recently I found some use for a tool adding const to a type if some other type is const.
...
same_cv
That's usually called copy_cv, and Google finds
https://svn.boost.org/trac/boost/ticket/3970
and
http://www.boost.org/doc/libs/master/boost/log/detail/copy_cv.hpp
The rest of the traits don't seem particularly popular.
I'm ok with moving it to TypeTraits, if anyone's interested.
2014-06-08 15:18 GMT+02:00 Andrey Semashev
On Sunday 08 June 2014 16:08:07 Peter Dimov wrote:
Adam Wulkiewicz wrote:
Hi,
Recently I found some use for a tool adding const to a type if some other type is const.
...
same_cv
That's usually called copy_cv, and Google finds
https://svn.boost.org/trac/boost/ticket/3970
and
http://www.boost.org/doc/libs/master/boost/log/detail/copy_cv.hpp
The rest of the traits don't seem particularly popular.
I'm ok with moving it to TypeTraits, if anyone's interested.
It's a good place for it, regarding the modularization. Separate copy_const and copy_volatile could be a nice complement. Regards, Adam
2014-06-08 16:16 GMT+02:00 Adam Wulkiewicz
2014-06-08 15:18 GMT+02:00 Andrey Semashev
: On Sunday 08 June 2014 16:08:07 Peter Dimov wrote:
Adam Wulkiewicz wrote:
Hi,
Recently I found some use for a tool adding const to a type if some other type is const.
...
same_cv
That's usually called copy_cv, and Google finds
Ah, and I didn't know this name, so I wrote myself traits like this a while ego.
https://svn.boost.org/trac/boost/ticket/3970
and
http://www.boost.org/doc/libs/master/boost/log/detail/copy_cv.hpp
The rest of the traits don't seem particularly popular.
I'm ok with moving it to TypeTraits, if anyone's interested.
It's a good place for it, regarding the modularization. Separate copy_const and copy_volatile could be a nice complement.
+1 Cheers, Kris
2014-06-08 15:08 GMT+02:00 Peter Dimov
Adam Wulkiewicz wrote:
Hi,
Recently I found some use for a tool adding const to a type if some other type is const.
...
same_cv
That's usually called copy_cv, and Google finds
https://svn.boost.org/trac/boost/ticket/3970
and
http://www.boost.org/doc/libs/master/boost/log/detail/copy_cv.hpp
Thanks for the info. same_cv is slightly different it could also remove qualifiers.
The rest of the traits don't seem particularly popular.
Ok. Regards, Adam
participants (4)
-
Adam Wulkiewicz
-
Andrey Semashev
-
Krzysztof Czainski
-
Peter Dimov