[ptr_map] Warning about returning address of local variable
I'm not sure if this a potential bug/problem or just a benign warning,
but when using the map_values range adaptor with a ptr_map container I
get a warning about returning an address of a local variable. It seems
benign as the expected processing happens, but this type of warning
generally doesn't sound like a good thing.
The following useless code will trigger it.
#include
Den 02-03-2018 kl. 23:09 skrev Bill Buklis via Boost-users:
I'm not sure if this a potential bug/problem or just a benign warning, but when using the map_values range adaptor with a ptr_map container I get a warning about returning an address of a local variable. It seems benign as the expected processing happens, but this type of warning generally doesn't sound like a good thing.
It's slightly complicatated, but it is from the range library the
warning is generated. ptr_map<> defines its iterator reference as
something which is not a reference:
ptr_container_detail::ref_pair
As an aside, I was a little surprised when trying out this little sample that the inclusion of the above headers is enough to require linking with the boost regex library. I figure it's probably a reference in the adaptors somewhere. It's not a big deal. These lib files are normally available anyway.
Yes, the tokenized adaptor is based on regexes: https://www.boost.org/doc/libs/1_66_0/libs/range/doc/html/range/reference/ad... -Thorsten
participants (2)
-
Bill Buklis
-
Thorsten Ottosen