alloc_copy.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
14d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne//===----------------------------------------------------------------------===//
24d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne//
34d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne// ��������������������The LLVM Compiler Infrastructure
44d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne//
54d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne// This file is distributed under the University of Illinois Open Source
64d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne// License. See LICENSE.TXT for details.
74d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne//
84d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne//===----------------------------------------------------------------------===//
94d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne
104d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne// <tuple>
114d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne
124d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne// template <class... Types> class tuple;
134d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne
144d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne// template <class Alloc>
154d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne//   tuple(allocator_arg_t, const Alloc& a, const tuple&);
164d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne
174d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne#include <tuple>
184d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne#include <cassert>
194d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne
204d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne#include "../allocators.h"
214d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne#include "../alloc_first.h"
224d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne#include "../alloc_last.h"
234d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne
244d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourneint main()
254d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne{
264d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne    {
274d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        typedef std::tuple<> T;
284d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        T t0;
294d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        T t(std::allocator_arg, A1<int>(), t0);
304d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne    }
314d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne    {
324d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        typedef std::tuple<int> T;
334d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        T t0(2);
344d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        T t(std::allocator_arg, A1<int>(), t0);
354d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        assert(std::get<0>(t) == 2);
364d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne    }
374d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne    {
384d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        typedef std::tuple<alloc_first> T;
394f9103faba72fdfc4b4299d6d459bc820ee597b2Matt Kopec        T t0(2);
404f9103faba72fdfc4b4299d6d459bc820ee597b2Matt Kopec        alloc_first::allocator_constructed = false;
414d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        T t(std::allocator_arg, A1<int>(5), t0);
424d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        assert(alloc_first::allocator_constructed);
434d623e869516c30d46d6d20d339a0e03116e7ac1Peter Collingbourne        assert(std::get<0>(t) == 2);
44    }
45    {
46        typedef std::tuple<alloc_last> T;
47        T t0(2);
48        alloc_last::allocator_constructed = false;
49        T t(std::allocator_arg, A1<int>(5), t0);
50        assert(alloc_last::allocator_constructed);
51        assert(std::get<0>(t) == 2);
52    }
53    {
54        typedef std::tuple<alloc_first, alloc_last> T;
55        T t0(2, 3);
56        alloc_first::allocator_constructed = false;
57        alloc_last::allocator_constructed = false;
58        T t(std::allocator_arg, A1<int>(5), t0);
59        assert(alloc_first::allocator_constructed);
60        assert(alloc_last::allocator_constructed);
61        assert(std::get<0>(t) == 2);
62        assert(std::get<1>(t) == 3);
63    }
64    {
65        typedef std::tuple<int, alloc_first, alloc_last> T;
66        T t0(1, 2, 3);
67        alloc_first::allocator_constructed = false;
68        alloc_last::allocator_constructed = false;
69        T t(std::allocator_arg, A1<int>(5), t0);
70        assert(alloc_first::allocator_constructed);
71        assert(alloc_last::allocator_constructed);
72        assert(std::get<0>(t) == 1);
73        assert(std::get<1>(t) == 2);
74        assert(std::get<2>(t) == 3);
75    }
76}
77