alloc: use nested namespace decl

This commit is contained in:
Danny Robson 2016-10-10 17:58:59 +11:00
parent 254a63ca90
commit e7bf2330ed
10 changed files with 20 additions and 20 deletions

View File

@ -19,13 +19,13 @@
#include <cstddef>
namespace util { namespace alloc {
namespace util::alloc {
template <class parent, class prefix, class suffix>
class affix {
void* allocate (size_t bytes, size_t align = alignof (std::max_align_t));
void deallocate (void *ptr, size_t bytes, size_t align = alignof (std::max_align_t));
};
} }
}
#include "./affix.hpp"

View File

@ -21,7 +21,7 @@
// C++11 allocator concept conformant allocator adaptor, going from our
// allocator interface to that of the STL and friends.
namespace util { namespace alloc {
namespace util::alloc {
template <class B, class T>
class allocator {
public:
@ -36,7 +36,7 @@ namespace util { namespace alloc {
private:
B &m_backing;
};
} }
}
#include "./allocator.ipp"

View File

@ -22,7 +22,7 @@
#include <memory>
#include <utility>
namespace util { namespace alloc {
namespace util::alloc {
template <class T>
class arena {
public:
@ -64,7 +64,7 @@ namespace util { namespace alloc {
private:
T &m_store;
};
} }
}
#include "./arena.ipp"

View File

@ -20,7 +20,7 @@
#include <cstddef>
#include <memory>
namespace util { namespace alloc {
namespace util::alloc {
// wraps an allocator given at construction time, forwarding all calls to
// the inner object. used to allow virtual dispatch of the non-virtual
// allocator interface.
@ -172,6 +172,6 @@ namespace util { namespace alloc {
std::unique_ptr<interface> m_child;
};
} }
}
#endif

View File

@ -19,7 +19,7 @@
#include <cstddef>
namespace util { namespace alloc {
namespace util::alloc {
template <class A, class B>
class fallback {
public:
@ -28,6 +28,6 @@ namespace util { namespace alloc {
void* allocate (size_t bytes, size_t align = alignof (std::max_align_t));
void deallocate (void *ptr, size_t bytes, size_t align = alignof (std::max_align_t));
};
} }
}
#endif

View File

@ -18,7 +18,7 @@
#define __UTIL_ALLOC_FWD_HPP
namespace util { namespace alloc {
namespace util::alloc {
class affix;
class dynamic;
class fallback;
@ -29,6 +29,6 @@ namespace util { namespace alloc {
template <typename T> class arena;
template <typename B, typename T> class allocator;
} }
}
#endif

View File

@ -19,7 +19,7 @@
#include <cstddef>
namespace util { namespace alloc {
namespace util::alloc {
// allocate progressively across a buffer without concern for deallocation.
// deallocation is a noop; the only way to free allocations is via reset.
class linear {
@ -45,7 +45,7 @@ namespace util { namespace alloc {
protected:
char *m_begin, *m_end, *m_cursor;
};
} }
}
#include "./linear.hpp"

View File

@ -20,13 +20,13 @@
#include <cstddef>
namespace util { namespace alloc {
namespace util::alloc {
class malloc {
public:
void* allocate (size_t bytes, size_t align = alignof (std::max_align_t));
void deallocate (void *ptr, size_t bytes, size_t align = alignof (std::max_align_t));
};
} }
}
#endif

View File

@ -20,7 +20,7 @@
#include <cstddef>
namespace util { namespace alloc {
namespace util::alloc {
// allocator that always fails, throwing bad_alloc. deallocate will
// succeed with nullptr as with delete, but is undefined with other values
// (it is likely to at least assert).
@ -38,6 +38,6 @@ namespace util { namespace alloc {
constexpr size_t used (void) const { return 0u; }
constexpr size_t remain (void) const { return 0u; }
};
} }
}
#endif

View File

@ -21,7 +21,7 @@
#include <cstdint>
namespace util { namespace alloc {
namespace util::alloc {
// allocate memory from a buffer in a stacklike manner. deallocation that
// is not correctly ordered has undefined (read 'bad') results.
class stack {
@ -48,6 +48,6 @@ namespace util { namespace alloc {
private:
char *m_begin, *m_end, *m_cursor;
};
} }
}
#endif