namespace axl::rc

namespace rc {

// typedefs

typedef void FreeFunc(void *p);
typedef RtFactory<mem::StdAllocator> RtFactory;

// enums

enum BufHdrFlag;
enum BufKind;
enum RefCountFlag;

// structs

struct BufHdr;
struct NullPtr;
struct RefCountAllocHdr;

// classes

template <typename T>
class Box;

template <
    typename T,
    typename SizeOf = sl::SizeOf<T>,
    typename Ref = BufRef<T, SizeOf>
    >
class Buf;

template <
    typename T,
    typename SizeOf = sl::SizeOf<T>
    >
class BufRef;

template <
    typename T,
    size_t extra = 0
    >
class Child;

template <typename T>
class Ptr;

class RefCount;

template <typename T>
class RefCountAllocBuffer;

template <typename T>
class Release;

template <typename Alloc = mem::StdAllocator>
class RtFactory;

template <typename T>
class WeakPtr;

template <typename T>
class WeakRelease;

// global variables

AXL_SELECT_ANY struct axl::rc::NullPtr g_nullPtr;

// global functions

void*
postAllocateRefCount(
    void* p,
    FreeFunc* freeFunc = &mem::StdAllocator::free
    );

template <typename T>
T*
primeAllocatedRefCount(T* p);

template <typename T>
T*
primeInPlaceRefCount(
    T* p,
    RefCount* parent,
    uint_t flags
    );

} // namespace rc