summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-04-14 09:06:56 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-04-17 12:05:53 +0300
commit9b1a6e6d32915cfc24eacd5d6b4ba68d1d74eb74 (patch)
tree82fad341d2ea59687260e1af24daa39078d58b1c /include
parent73697fce9a9ba7ae97b4a0bf6313fa864ba5b587 (diff)
downloadbdwgc-9b1a6e6d32915cfc24eacd5d6b4ba68d1d74eb74.tar.gz
Allow gc_allocator<T> and friends to be defined in namespace boehmgc
The client should define GC_NAMESPACE_ALLOCATOR before include gc_allocator.h to have all symbols of the latter to be defined in namespace boehmgc. * docs/README.macros (GC_NAMESPACE_ALLOCATOR): Document. * include/gc/gc_allocator.h [GC_NAMESPACE_ALLOCATOR] (GC_true_type, GC_false_type, GC_type_traits, GC_DECLARE_PTRFREE, GC_selective_alloc, gc_allocator, gc_allocator_ignore_off_page, traceable_allocator): Define symbols (all) in boehmgc namespace. * tests/cpp.cc (GC_NAMESPACE_ALLOCATOR): Define macro (before include gc_allocator.h). * tests/cpp.cc (gc_allocator, gc_allocator_ignore_off_page, traceable_allocator): Using the symbol of namespace boehmgc.
Diffstat (limited to 'include')
-rw-r--r--include/gc/gc_allocator.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/gc/gc_allocator.h b/include/gc/gc_allocator.h
index 44e3926c..89152f90 100644
--- a/include/gc/gc_allocator.h
+++ b/include/gc/gc_allocator.h
@@ -44,6 +44,11 @@
#include <new> // for placement new and bad_alloc
+#ifdef GC_NAMESPACE_ALLOCATOR
+namespace boehmgc
+{
+#endif
+
#if !defined(GC_NO_MEMBER_TEMPLATES) && defined(_MSC_VER) && _MSC_VER <= 1200
// MSVC++ 6.0 do not support member templates.
# define GC_NO_MEMBER_TEMPLATES
@@ -333,4 +338,8 @@ inline bool operator!=(const traceable_allocator<GC_T1>&,
return false;
}
+#ifdef GC_NAMESPACE_ALLOCATOR
+}
+#endif
+
#endif /* GC_ALLOCATOR_H */