diff --git a/doc/container.qbk b/doc/container.qbk
index 91cdbc8..1e9c9e7 100644
--- a/doc/container.qbk
+++ b/doc/container.qbk
@@ -1338,6 +1338,13 @@ use [*Boost.Container]? There are several reasons for that:
[section:release_notes Release Notes]
+[section:release_notes_boost_1_77_00 Boost 1.77 Release]
+
+* Fixed bugs/issues:
+ * [@https://github.com/boostorg/container/issues/184 GitHub #184: ['"Issues with custom exceptions implementation"]].
+
+[endsect]
+
[section:release_notes_boost_1_76_00 Boost 1.76 Release]
* Added [[no-discard]] attribute in all containers to catch bugs related to unused return values.
diff --git a/include/boost/container/adaptive_pool.hpp b/include/boost/container/adaptive_pool.hpp
index 08e4f62..76c620f 100644
--- a/include/boost/container/adaptive_pool.hpp
+++ b/include/boost/container/adaptive_pool.hpp
@@ -153,7 +153,7 @@ class adaptive_pool
{ return size_type(-1)/(2u*sizeof(T)); }
//!Allocate memory for an array of count elements.
- //!Throws std::bad_alloc if there is no enough memory
+ //!Throws bad_alloc if there is no enough memory
pointer allocate(size_type count, const void * = 0)
{
if(BOOST_UNLIKELY(count > size_type(-1)/(2u*sizeof(T))))
@@ -467,7 +467,7 @@ class private_adaptive_pool
{ return size_type(-1)/(2u*sizeof(T)); }
//!Allocate memory for an array of count elements.
- //!Throws std::bad_alloc if there is no enough memory
+ //!Throws bad_alloc if there is no enough memory
pointer allocate(size_type count, const void * = 0)
{
if(BOOST_UNLIKELY(count > size_type(-1)/(2u*sizeof(T))))
diff --git a/include/boost/container/allocator.hpp b/include/boost/container/allocator.hpp
index 195a523..8489f48 100644
--- a/include/boost/container/allocator.hpp
+++ b/include/boost/container/allocator.hpp
@@ -174,7 +174,7 @@ class allocator
{}
//!Allocates memory for an array of count elements.
- //!Throws std::bad_alloc if there is no enough memory
+ //!Throws bad_alloc if there is no enough memory
//!If Version is 2, this allocated memory can only be deallocated
//!with deallocate() or (for Version == 2) deallocate_many()
BOOST_CONTAINER_ATTRIBUTE_NODISCARD pointer allocate(size_type count, const void * hint= 0)
diff --git a/include/boost/container/detail/adaptive_node_pool.hpp b/include/boost/container/detail/adaptive_node_pool.hpp
index d14e865..9dd89b1 100644
--- a/include/boost/container/detail/adaptive_node_pool.hpp
+++ b/include/boost/container/detail/adaptive_node_pool.hpp
@@ -111,7 +111,7 @@ class shared_adaptive_node_pool
~shared_adaptive_node_pool()
{}
- //!Allocates array of count elements. Can throw std::bad_alloc
+ //!Allocates array of count elements. Can throw bad_alloc
void *allocate_node()
{
//-----------------------
@@ -130,7 +130,7 @@ class shared_adaptive_node_pool
}
//!Allocates a singly linked list of n nodes ending in null pointer.
- //!can throw std::bad_alloc
+ //!can throw bad_alloc
void allocate_nodes(const std::size_t n, multiallocation_chain &chain)
{
//-----------------------
diff --git a/include/boost/container/detail/node_pool.hpp b/include/boost/container/detail/node_pool.hpp
index e43956b..6490772 100644
--- a/include/boost/container/detail/node_pool.hpp
+++ b/include/boost/container/detail/node_pool.hpp
@@ -82,7 +82,7 @@ class shared_node_pool
~shared_node_pool()
{}
- //!Allocates array of count elements. Can throw std::bad_alloc
+ //!Allocates array of count elements. Can throw bad_alloc
void *allocate_node()
{
//-----------------------
@@ -101,7 +101,7 @@ class shared_node_pool
}
//!Allocates a singly linked list of n nodes ending in null pointer.
- //!can throw std::bad_alloc
+ //!can throw bad_alloc
void allocate_nodes(const std::size_t n, multiallocation_chain &chain)
{
//-----------------------
diff --git a/include/boost/container/devector.hpp b/include/boost/container/devector.hpp
index 7aa4186..d068dff 100644
--- a/include/boost/container/devector.hpp
+++ b/include/boost/container/devector.hpp
@@ -1269,7 +1269,7 @@ class devector
/**
* **Returns**: A reference to the `n`th element in the devector.
*
- * **Throws**: `std::out_of_range`, if `n >= size()`.
+ * **Throws**: `out_of_range`, if `n >= size()`.
*
* **Complexity**: Constant.
*/
@@ -1284,7 +1284,7 @@ class devector
/**
* **Returns**: A constant reference to the `n`th element in the devector.
*
- * **Throws**: `std::out_of_range`, if `n >= size()`.
+ * **Throws**: `out_of_range`, if `n >= size()`.
*
* **Complexity**: Constant.
*/
diff --git a/include/boost/container/new_allocator.hpp b/include/boost/container/new_allocator.hpp
index 4801f70..2fad21a 100644
--- a/include/boost/container/new_allocator.hpp
+++ b/include/boost/container/new_allocator.hpp
@@ -151,7 +151,7 @@ class new_allocator
{}
//!Allocates memory for an array of count elements.
- //!Throws std::bad_alloc if there is no enough memory
+ //!Throws bad_alloc if there is no enough memory
pointer allocate(size_type count)
{
const std::size_t max_count = std::size_t(-1)/(2*sizeof(T));
diff --git a/include/boost/container/node_allocator.hpp b/include/boost/container/node_allocator.hpp
index 4ecb6f8..64719fd 100644
--- a/include/boost/container/node_allocator.hpp
+++ b/include/boost/container/node_allocator.hpp
@@ -141,7 +141,7 @@ class node_allocator
{ return size_type(-1)/sizeof(T); }
//!Allocate memory for an array of count elements.
- //!Throws std::bad_alloc if there is no enough memory
+ //!Throws bad_alloc if there is no enough memory
pointer allocate(size_type count, const void * = 0)
{
if(BOOST_UNLIKELY(count > this->max_size()))
diff --git a/include/boost/container/static_vector.hpp b/include/boost/container/static_vector.hpp
index 3678947..6a9de7f 100644
--- a/include/boost/container/static_vector.hpp
+++ b/include/boost/container/static_vector.hpp
@@ -137,10 +137,10 @@ struct get_static_vector_allocator
//!possible.
//!
//!@par Error Handling
-//! Insertion beyond the capacity result in throwing std::bad_alloc() if exceptions are enabled or
+//! Insertion beyond the capacity result in throwing bad_alloc() if exceptions are enabled or
//! calling throw_bad_alloc() if not enabled.
//!
-//! std::out_of_range is thrown if out of bounds access is performed in at()
if exceptions are
+//! out_of_range is thrown if out of bounds access is performed in at()
if exceptions are
//! enabled, throw_out_of_range() if not enabled.
//!
//!@tparam T The type of element that will be stored.
@@ -788,7 +788,7 @@ public:
//! from the beginning of the container.
//!
//! @par Throws
- //! \c std::out_of_range exception by default.
+ //! \c out_of_range exception by default.
//!
//! @par Complexity
//! Constant O(1).
@@ -804,7 +804,7 @@ public:
//! from the beginning of the container.
//!
//! @par Throws
- //! \c std::out_of_range exception by default.
+ //! \c out_of_range exception by default.
//!
//! @par Complexity
//! Constant O(1).
diff --git a/include/boost/container/throw_exception.hpp b/include/boost/container/throw_exception.hpp
index 5ab7d12..ebb8926 100644
--- a/include/boost/container/throw_exception.hpp
+++ b/include/boost/container/throw_exception.hpp
@@ -27,22 +27,27 @@
#include //for std exception base
# if defined(BOOST_CONTAINER_USE_STD_EXCEPTIONS)
- #include //for std exception types
+ #include //for std::out_of_range, std::length_error, std::logic_error, std::runtime_error
#include //for implicit std::string conversion
#include //for std::bad_alloc
+namespace boost {
+namespace container {
+
typedef std::bad_alloc bad_alloc_t;
typedef std::out_of_range out_of_range_t;
-typedef std::out_of_range length_error_t;
+typedef std::length_error length_error_t;
typedef std::logic_error logic_error_t;
typedef std::runtime_error runtime_error_t;
+}} //namespace boost::container
+
# else //!BOOST_CONTAINER_USE_STD_EXCEPTIONS
namespace boost {
namespace container {
-class exception
+class BOOST_SYMBOL_EXPORT exception
: public ::std::exception
{
typedef ::std::exception std_exception_t;
@@ -61,7 +66,7 @@ class exception
const char *m_msg;
};
-class bad_alloc
+class BOOST_SYMBOL_EXPORT bad_alloc
: public exception
{
public:
@@ -72,7 +77,7 @@ class bad_alloc
typedef bad_alloc bad_alloc_t;
-class out_of_range
+class BOOST_SYMBOL_EXPORT out_of_range
: public exception
{
public:
@@ -83,7 +88,7 @@ class out_of_range
typedef out_of_range out_of_range_t;
-class length_error
+class BOOST_SYMBOL_EXPORT length_error
: public exception
{
public:
@@ -94,7 +99,7 @@ class length_error
typedef out_of_range length_error_t;
-class logic_error
+class BOOST_SYMBOL_EXPORT logic_error
: public exception
{
public:
@@ -105,7 +110,7 @@ class logic_error
typedef logic_error logic_error_t;
-class runtime_error
+class BOOST_SYMBOL_EXPORT runtime_error
: public exception
{
public:
@@ -181,7 +186,11 @@ namespace container {
//! Exception callback called by Boost.Container when fails to allocate the requested storage space.
//!
- //! - If BOOST_NO_EXCEPTIONS is NOT defined
std::bad_alloc()
is thrown.
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is NOT defined
+ //!
boost::container::bad_alloc(str)
is thrown.
+ //!
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is defined
+ //!
std::bad_alloc(str)
is thrown.
//!
//! - If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined
BOOST_ASSERT(!"boost::container bad_alloc thrown")
is called
@@ -192,16 +201,16 @@ namespace container {
//!
BOOST_NORETURN inline void throw_bad_alloc()
{
- #ifdef BOOST_CONTAINER_USE_STD_EXCEPTIONS
- throw std::bad_alloc();
- #else
- throw bad_alloc();
- #endif
+ throw bad_alloc_t();
}
//! Exception callback called by Boost.Container to signal arguments out of range.
//!
- //! - If BOOST_NO_EXCEPTIONS is NOT defined
std::out_of_range(str)
is thrown.
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is NOT defined
+ //!
boost::container::out_of_range(str)
is thrown.
+ //!
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is defined
+ //!
std::out_of_range(str)
is thrown.
//!
//! - If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined
BOOST_ASSERT_MSG(!"boost::container out_of_range thrown", str)
is called
@@ -212,16 +221,17 @@ namespace container {
//!
BOOST_NORETURN inline void throw_out_of_range(const char* str)
{
- #ifdef BOOST_CONTAINER_USE_STD_EXCEPTIONS
- throw std::out_of_range(str);
- #else
- throw out_of_range(str);
- #endif
+ throw out_of_range_t(str);
}
//! Exception callback called by Boost.Container to signal errors resizing.
//!
- //! - If BOOST_NO_EXCEPTIONS is NOT defined
std::length_error(str)
is thrown.
+ //!
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is NOT defined
+ //!
boost::container::length_error(str)
is thrown.
+ //!
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is defined
+ //!
std::length_error(str)
is thrown.
//!
//! - If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined
BOOST_ASSERT_MSG(!"boost::container length_error thrown", str)
is called
@@ -232,17 +242,18 @@ namespace container {
//!
BOOST_NORETURN inline void throw_length_error(const char* str)
{
- #ifdef BOOST_CONTAINER_USE_STD_EXCEPTIONS
- throw std::length_error(str);
- #else
- throw length_error(str);
- #endif
+ throw length_error_t(str);
}
//! Exception callback called by Boost.Container to report errors in the internal logical
//! of the program, such as violation of logical preconditions or class invariants.
//!
- //! - If BOOST_NO_EXCEPTIONS is NOT defined
std::logic_error(str)
is thrown.
+ //!
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is NOT defined
+ //!
boost::container::logic_error(str)
is thrown.
+ //!
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is defined
+ //!
std::logic_error(str)
is thrown.
//!
//! - If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined
BOOST_ASSERT_MSG(!"boost::container logic_error thrown", str)
is called
@@ -253,16 +264,16 @@ namespace container {
//!
BOOST_NORETURN inline void throw_logic_error(const char* str)
{
- #ifdef BOOST_CONTAINER_USE_STD_EXCEPTIONS
- throw std::logic_error(str);
- #else
- throw logic_error(str);
- #endif
+ throw logic_error_t(str);
}
//! Exception callback called by Boost.Container to report errors that can only be detected during runtime.
//!
- //! - If BOOST_NO_EXCEPTIONS is NOT defined
std::runtime_error(str)
is thrown.
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is NOT defined
+ //!
boost::container::runtime_error(str)
is thrown.
+ //!
+ //! - If BOOST_NO_EXCEPTIONS is NOT defined and BOOST_CONTAINER_USE_STD_EXCEPTIONS is defined
+ //!
std::runtime_error(str)
is thrown.
//!
//! - If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined
BOOST_ASSERT_MSG(!"boost::container runtime_error thrown", str)
is called
@@ -273,11 +284,7 @@ namespace container {
//!
BOOST_NORETURN inline void throw_runtime_error(const char* str)
{
- #ifdef BOOST_CONTAINER_USE_STD_EXCEPTIONS
- throw std::runtime_error(str);
- #else
- throw runtime_error(str);
- #endif
+ throw runtime_error_t(str);
}
#endif