]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
Vendor import of libc++ trunk r302418:
[FreeBSD/FreeBSD.git] / test / libcxx / experimental / containers / sequences / dynarray / dynarray.mutate / default.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // UNSUPPORTED: c++98, c++03, c++11
11 // XFAIL: availability
12
13 // dynarray.data
14
15 // void fill(const T& v);
16 // const T* data() const noexcept;
17
18
19 #include <__config>
20
21 #include <experimental/dynarray>
22 #include <cassert>
23
24 #include <algorithm>
25 #include <complex>
26 #include <string>
27
28 using std::experimental::dynarray;
29
30 template <class T>
31 void test ( const T &val ) {
32     typedef dynarray<T> dynA;
33
34     dynA d1 ( 4 );
35     d1.fill ( val );
36     assert ( std::all_of ( d1.begin (), d1.end (),
37                     [&val]( const T &item ){ return item == val; } ));
38     }
39
40 int main()
41 {
42     test<int> ( 14 );
43     test<double> ( 14.0 );
44     test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
45     test<std::string> ( "fourteen" );
46 }
47