default.pass.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. // UNSUPPORTED: c++98, c++03, c++11
  10. // XFAIL: availability
  11. // dynarray.data
  12. // void fill(const T& v);
  13. // const T* data() const noexcept;
  14. #include <__config>
  15. #include <experimental/dynarray>
  16. #include <cassert>
  17. #include <algorithm>
  18. #include <complex>
  19. #include <string>
  20. using std::experimental::dynarray;
  21. template <class T>
  22. void test ( const T &val ) {
  23. typedef dynarray<T> dynA;
  24. dynA d1 ( 4 );
  25. d1.fill ( val );
  26. assert ( std::all_of ( d1.begin (), d1.end (),
  27. [&val]( const T &item ){ return item == val; } ));
  28. }
  29. int main()
  30. {
  31. test<int> ( 14 );
  32. test<double> ( 14.0 );
  33. test<std::complex<double>> ( std::complex<double> ( 14, 0 ));
  34. test<std::string> ( "fourteen" );
  35. }