//===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // // explicit forward_list(size_type n); // explicit forward_list(size_type n, const Alloc& a); #include #include #include "../../../DefaultOnly.h" #include "../../../min_allocator.h" template void check_allocator(unsigned n, Allocator const &alloc = Allocator()) { #if _LIBCPP_STD_VER > 11 typedef std::forward_list C; C d(n, alloc); assert(d.get_allocator() == alloc); assert(std::distance(d.begin(), d.end()) == n); #endif } int main() { { typedef DefaultOnly T; typedef std::forward_list C; unsigned N = 10; C c(N); unsigned n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES assert(*i == T()); #else ; #endif assert(n == N); } #if __cplusplus >= 201103L { typedef DefaultOnly T; typedef std::forward_list> C; unsigned N = 10; C c(N); unsigned n = 0; for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES assert(*i == T()); #else ; #endif assert(n == N); check_allocator> ( 0 ); check_allocator> ( 3 ); } #endif }