mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 20:29:39 +08:00
Summary: This patch adds std::any by moving/adapting <experimental/any>. This patch also implements the std::any parts of p0032r3 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf) and LWG 2509 (http://cplusplus.github.io/LWG/lwg-defects.html#2509). I plan to push it in a day or two if there are no comments. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22733 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278310 91177308-0d34-0410-b5e6-96231b3b80d8
39 lines
878 B
C++
39 lines
878 B
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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>
|
|
|
|
// any() noexcept;
|
|
|
|
#include <experimental/any>
|
|
#include <type_traits>
|
|
#include <cassert>
|
|
|
|
#include "experimental_any_helpers.h"
|
|
#include "count_new.hpp"
|
|
|
|
|
|
int main()
|
|
{
|
|
using std::experimental::any;
|
|
{
|
|
static_assert(
|
|
std::is_nothrow_default_constructible<any>::value
|
|
, "Must be default constructible"
|
|
);
|
|
}
|
|
{
|
|
DisableAllocationGuard g; ((void)g);
|
|
any const a;
|
|
assertEmpty(a);
|
|
}
|
|
}
|