[Boost-bugs] [Boost C++ Libraries] #11957: static_vector::max_size() is higher than the capacity

Subject: [Boost-bugs] [Boost C++ Libraries] #11957: static_vector::max_size() is higher than the capacity
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-05 09:01:33


#11957: static_vector::max_size() is higher than the capacity
------------------------------+------------------------
 Reporter: anonymous | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------
 According to the documenetation, both static_vector capacity() and
 max_size() shall return the static_vector capacity:
 {{{
 static_vector public static functions

   static size_type capacity() noexcept;
     Returns container's capacity.
     Throws. Nothing.
     Complexity. Constant O(1).

   static size_type max_size() noexcept;
     Returns container's capacity.
     Throws. Nothing.
     Complexity. Constant O(1).
 }}}
 This makes sense since the capacity is fixed at compile time.

 However it is not actually the case


 {{{
 $ cat svect.cpp
 #include <cstdlib>
 #include <boost/container/static_vector.hpp>
 #include <iostream>

 int main()
 {
   boost::container::static_vector<char, 42> sv;
   std::cout << "sv.size(): " << sv.size()
             << "\nsv.capacity(): " << sv.capacity()
             << "\nsv.max_size(): " << sv.max_size() << "\n";
   return (sv.max_size() == sv.capacity()) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 }}}
 {{{
 $ clang++ --std=c++11 svect.cpp && ./a.out
 sv.size(): 0
 sv.capacity(): 42
 sv.max_size(): 18446744073709551615
 }}}
 {{{
 $ echo $?
 1
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11957>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC