[IdentityType] Const omission undocumented.

#include

On 16/11/2013 01:02, Mostafa wrote:
#include
#include <utility> int main() { BOOST_IDENTITY_TYPE(( std::pair
const )) x; // This compiles, so the const qualification in the // above macro parameter is ignored. x = std::make_pair(0,1); return 0; }
The omission of const qualification in BOOST_IDENTITY_TYPE types is undocumented. This omission maybe deduced from the documented implementation, but, as noted, that is not part of the library api and is subject to change. I therefore propose that this behaviour be documented as part of the library's public api.
That looks like a bug.

On Sat, Nov 16, 2013 at 11:18 AM, Mathias Gaunard
On 16/11/2013 01:02, Mostafa wrote:
#include
#include <utility> int main() { BOOST_IDENTITY_TYPE(( std::pair
const )) x; // This compiles, so the const qualification in the // above macro parameter is ignored. x = std::make_pair(0,1); return 0; }
The omission of const qualification in BOOST_IDENTITY_TYPE types is undocumented. This omission maybe deduced from the documented implementation, but, as noted, that is not part of the library api and is subject to change. I therefore propose that this behaviour be documented as part of the library's public api.
That looks like a bug.
Is there a way to extract the cv-qualifier from a function parameter
type at compile-time?
some_mata_function

2013/12/3 Lorenzo Caminiti
On Sat, Nov 16, 2013 at 11:18 AM, Mathias Gaunard
wrote: On 16/11/2013 01:02, Mostafa wrote:
#include
#include <utility> int main() { BOOST_IDENTITY_TYPE(( std::pair
const )) x; // This compiles, so the const qualification in the // above macro parameter is ignored. x = std::make_pair(0,1); return 0; }
The omission of const qualification in BOOST_IDENTITY_TYPE types is undocumented. This omission maybe deduced from the documented implementation, but, as noted, that is not part of the library api and is subject to change. I therefore propose that this behaviour be documented as part of the library's public api.
That looks like a bug.
Is there a way to extract the cv-qualifier from a function parameter type at compile-time?
some_mata_function
::type // evaluates to `int const` not just `int` Right now I do the following which looses the cv-qualifier (I also tried to program my own meta-functions but I wan't able to retain the cv-qualifier).
boost::function_traits
::arg1_type // evaluates to `int` and not to `int conat` :(
how about (not tested):
boost::remove_reference< boost::function_traits

On Tue, 03 Dec 2013 11:23:46 -0800, Krzysztof Czainski <1czajnik@gmail.com> wrote:
2013/12/3 Lorenzo Caminiti
On Sat, Nov 16, 2013 at 11:18 AM, Mathias Gaunard
wrote: On 16/11/2013 01:02, Mostafa wrote:
#include
#include <utility> int main() { BOOST_IDENTITY_TYPE(( std::pair
const )) x; // This compiles, so the const qualification in the // above macro parameter is ignored. x = std::make_pair(0,1); return 0; }
The omission of const qualification in BOOST_IDENTITY_TYPE types is undocumented. This omission maybe deduced from the documented implementation, but, as noted, that is not part of the library api
and
is subject to change. I therefore propose that this behaviour be documented as part of the library's public api.
That looks like a bug.
Is there a way to extract the cv-qualifier from a function parameter type at compile-time?
some_mata_function
::type // evaluates to `int const` not just `int` Right now I do the following which looses the cv-qualifier (I also tried to program my own meta-functions but I wan't able to retain the cv-qualifier).
boost::function_traits
::arg1_type // evaluates to `int` and not to `int conat` :( how about (not tested): boost::remove_reference< boost::function_traits
::arg1_type >::type
Pointers should be used instead. References will lead to bugs because of
reference collapsing when add_reference is used. For example:
BOOST_IDENTITY_TYPE(( std::pair

On Tue, Dec 3, 2013 at 1:39 PM, Mostafa
On Tue, 03 Dec 2013 11:23:46 -0800, Krzysztof Czainski <1czajnik@gmail.com>
2013/12/3 Lorenzo Caminiti
On Sat, Nov 16, 2013 at 11:18 AM, Mathias Gaunard
wrote: On 16/11/2013 01:02, Mostafa wrote: That looks like a bug.
Is there a way to extract the cv-qualifier from a function parameter type at compile-time?
how about (not tested): boost::remove_reference< boost::function_traits
::arg1_type >::type Pointers should be used instead. References will lead to bugs because of reference collapsing when add_reference is used. For example:
BOOST_IDENTITY_TYPE(( std::pair
& )) x; will be incorrectly deduced as std::pair
I can't change the tokens "(int const)" because these are specified by the user of BOOST_IDENTITY_TYPE(tokens) (and I cannot inspect them within the outermost parenthesis without variadic macros, which is the point of Boost.IdentityType). So I cannot do (int const&), (int const*), etc :( --Lorenzo
participants (4)
-
Krzysztof Czainski
-
Lorenzo Caminiti
-
Mathias Gaunard
-
Mostafa