[boost] [container] 1.56.0 flat_map static assert typo ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[boost] [container] 1.56.0 flat_map static assert typo ?

feverzsj
hi, list
  in <boost/container/flat_map.hpp>,  the ctors seems to contain a wrong static assert:

   flat_map()
      : m_flat_tree()
   {
      //Allocator type must be std::pair<CONST Key, T>
      BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
   }

   missing "const" ?

regards.
Reply | Threaded
Open this post in threaded view
|

Re: [container] 1.56.0 flat_map static assert typo ?

Ion Gaztañaga
El 09/08/2014 9:53, feverzsj escribió:

> hi, list
>    in <boost/container/flat_map.hpp>,  the ctors seems to contain a wrong
> static assert:
>
>     flat_map()
>        : m_flat_tree()
>     {
>        //Allocator type must be std::pair<CONST Key, T>
>        BOOST_STATIC_ASSERT((container_detail::is_same<std::pair&lt;Key, T>,
> typename Allocator::value_type>::value));
>     }
>
>     missing "const" ?

No. flat_map is different from map, the key is not const. See the
default allocator argument, it's std::allocator< std::pair<Key, T> >

Best,

Ion

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [container] 1.56.0 flat_map static assert typo ?

Brian Smith
On 8/9/14, Ion Gaztañaga <[hidden email]> wrote:

> El 09/08/2014 9:53, feverzsj escribió:
>> hi, list
>>    in <boost/container/flat_map.hpp>,  the ctors seems to contain a wrong
>> static assert:
>>
>>     flat_map()
>>        : m_flat_tree()
>>     {
>>        //Allocator type must be std::pair<CONST Key, T>
>>        BOOST_STATIC_ASSERT((container_detail::is_same<std::pair&lt;Key,
>> T>,
>> typename Allocator::value_type>::value));
>>     }
>>
>>     missing "const" ?
>
> No. flat_map is different from map, the key is not const. See the
> default allocator argument, it's std::allocator< std::pair<Key, T> >
>

The constructors have a typo in the comment above the assert though.


Brian

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [container] 1.56.0 flat_map static assert typo ?

Ion Gaztañaga
El 09/08/2014 13:58, Brian Smith escribió:
>
> The constructors have a typo in the comment above the assert though.

Thanks. Fixed in develop branch now.

Ion

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost