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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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