#include "config.h"
#include <type_traits>
#include <utility>
#include <wtf/Assertions.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
namespace WTF {
#ifndef NDEBUG
struct SameSizeAsRefCounted {
int a;
bool b;
bool c;
};
#else
struct SameSizeAsRefCounted {
int a;
};
#endif
template<typename T, unsigned inlineCapacity = 0>
struct SameSizeAsVectorWithInlineCapacity;
template<typename T>
struct SameSizeAsVectorWithInlineCapacity<T, 0> {
void* bufferPointer;
unsigned capacity;
unsigned size;
};
template<typename T, unsigned inlineCapacity>
struct SameSizeAsVectorWithInlineCapacity {
SameSizeAsVectorWithInlineCapacity<T, 0> baseCapacity;
typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type inlineBuffer[inlineCapacity];
};
static_assert(sizeof(OwnPtr<int>) == sizeof(int*), "OwnPtr should stay small!");
static_assert(sizeof(PassRefPtr<RefCounted<int>>) == sizeof(int*), "PassRefPtr should stay small!");
static_assert(sizeof(RefCounted<int>) == sizeof(SameSizeAsRefCounted), "RefCounted should stay small!");
static_assert(sizeof(RefPtr<RefCounted<int>>) == sizeof(int*), "RefPtr should stay small!");
static_assert(sizeof(Vector<int>) == sizeof(SameSizeAsVectorWithInlineCapacity<int>), "Vector should stay small!");
static_assert(sizeof(Vector<int, 1>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 1>), "Vector should stay small!");
static_assert(sizeof(Vector<int, 2>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 2>), "Vector should stay small!");
static_assert(sizeof(Vector<int, 3>) == sizeof(SameSizeAsVectorWithInlineCapacity<int, 3>), "Vector should stay small!");
}