|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2008-01-20 16:32:04
Author: danieljames
Date: 2008-01-20 16:32:04 EST (Sun, 20 Jan 2008)
New Revision: 42887
URL: http://svn.boost.org/trac/boost/changeset/42887
Log:
Merged revisions 42590-42664,42667-42697,42699-42723,42725-42855,42857-42881 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r42881 | danieljames | 2008-01-20 17:37:21 +0000 (Sun, 20 Jan 2008) | 1 line
Include <new> to get std::bad_alloc.
........
Properties modified:
branches/unordered/trunk/ (props changed)
Text files modified:
branches/unordered/trunk/libs/unordered/test/helpers/allocator.hpp | 9 +++++++--
branches/unordered/trunk/libs/unordered/test/objects/exception.hpp | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
Modified: branches/unordered/trunk/libs/unordered/test/helpers/allocator.hpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/helpers/allocator.hpp (original)
+++ branches/unordered/trunk/libs/unordered/test/helpers/allocator.hpp 2008-01-20 16:32:04 EST (Sun, 20 Jan 2008)
@@ -9,6 +9,7 @@
#include <cstddef>
#include <cstdlib>
#include <boost/limits.hpp>
+#include <new>
#if defined(BOOST_MSVC)
#pragma warning(push)
@@ -39,7 +40,9 @@
pointer allocate(size_type n) {
using namespace std;
- return static_cast<T*>(malloc(n * sizeof(T)));
+ T* ptr = static_cast<T*>(malloc(n * sizeof(T)));
+ if(!ptr) throw std::bad_alloc();
+ return ptr;
}
pointer allocate(size_type n, const_pointer u) { return allocate(n); }
@@ -71,7 +74,9 @@
}
char* _Charalloc(size_type n) {
using namespace std;
- return static_cast<char*>(malloc(n * sizeof(char)));
+ T* ptr = static_cast<T*>(malloc(n * sizeof(char)));
+ if(!ptr) throw std::bad_alloc();
+ return ptr;
}
#endif
};
Modified: branches/unordered/trunk/libs/unordered/test/objects/exception.hpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/objects/exception.hpp (original)
+++ branches/unordered/trunk/libs/unordered/test/objects/exception.hpp 2008-01-20 16:32:04 EST (Sun, 20 Jan 2008)
@@ -11,6 +11,7 @@
#include <cstddef>
#include <iostream>
#include <boost/limits.hpp>
+#include <new>
#include "../helpers/fwd.hpp"
#include "../helpers/allocator.hpp"
#include "./memory.hpp"
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk