[libcxx] Add <experimental/any> v2.

Summary:
This patch adds the second revision of <experimental/any>. 
I've been working from the LFTS draft found at this link. https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#any



Reviewers: danalbert, jroelofs, K-ballo, mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6762

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243728 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2015-07-31 02:24:58 +00:00
parent 26d2390a8d
commit 7175a07921
28 changed files with 2873 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/any>
// Check that the size and alignment of any are what we expect.
#include <experimental/any>
int main()
{
using std::experimental::any;
static_assert(sizeof(any) == sizeof(void*)*4, "");
static_assert(alignof(any) == alignof(void*), "");
}

View File

@@ -0,0 +1,40 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// <experimental/any>
// Check that the size and alignment of any are what we expect.
#include <experimental/any>
#include "any_helpers.h"
class SmallThrowsDtor
{
public:
SmallThrowsDtor() {}
SmallThrowsDtor(SmallThrowsDtor const &) noexcept {}
SmallThrowsDtor(SmallThrowsDtor &&) noexcept {}
~SmallThrowsDtor() noexcept(false) {}
};
int main()
{
using std::experimental::any;
using std::experimental::__any_imp::_IsSmallObject;
static_assert(_IsSmallObject<small>::value, "");
static_assert(_IsSmallObject<void*>::value, "");
static_assert(!_IsSmallObject<SmallThrowsDtor>::value, "");
static_assert(!_IsSmallObject<large>::value, "");
// long double is over aligned.
static_assert(sizeof(long double) <= sizeof(void*) * 3, "");
static_assert(alignof(long double) > alignof(void*), "");
static_assert(!_IsSmallObject<long double>::value, "");
}

View File

@@ -0,0 +1,20 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <experimental/any>
#include <experimental/any>
#ifndef _LIBCPP_VERSION
#error _LIBCPP_VERSION not defined
#endif
int main()
{
}