1  // Copyright (C) 2001-2023 Free Software Foundation, Inc.
       2  //
       3  // This file is part of the GNU ISO C++ Library.  This library is free
       4  // software; you can redistribute it and/or modify it under the
       5  // terms of the GNU General Public License as published by the
       6  // Free Software Foundation; either version 3, or (at your option)
       7  // any later version.
       8  
       9  // This library is distributed in the hope that it will be useful,
      10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12  // GNU General Public License for more details.
      13  
      14  // You should have received a copy of the GNU General Public License along
      15  // with this library; see the file COPYING3.  If not see
      16  // <http://www.gnu.org/licenses/>.
      17  
      18  // 23.2.2.1 list constructors, copy, and assignment
      19  
      20  #include <testsuite_hooks.h>
      21  
      22  // A nontrivial type.
      23  template<typename T>
      24    struct A { };
      25  
      26  // Another nontrivial type
      27  struct B { };
      28  
      29  // Default constructor, basic properties
      30  //
      31  // This test verifies the following.
      32  // 23.2.2.1     explicit list(const a& = Allocator())
      33  // 23.1 (7)     iterator behaviour of empty containers
      34  // 23.2.2       iterator begin()
      35  // 23.2.2       iterator end()
      36  // 23.2.2       size_type size() const
      37  // 23.2.2	existence of required typedefs
      38  //
      39  template<typename _Tp>
      40  void
      41  cons01()
      42  {
      43    typedef _Tp list_type;
      44  
      45    list_type list0101;
      46    VERIFY(list0101.begin() == list0101.end());
      47    VERIFY(list0101.size() == 0);
      48  
      49    // check type definitions -- will fail compile if missing
      50    typedef typename list_type::reference              reference;
      51    typedef typename list_type::const_reference        const_reference;
      52    typedef typename list_type::iterator               iterator;
      53    typedef typename list_type::const_iterator         const_iterator;
      54    typedef typename list_type::size_type              size_type;
      55    typedef typename list_type::difference_type        difference_type;
      56    typedef typename list_type::value_type             value_type;
      57    typedef typename list_type::allocator_type         allocator_type;
      58    typedef typename list_type::pointer                pointer;
      59    typedef typename list_type::const_pointer          const_pointer;
      60    typedef typename list_type::reverse_iterator       reverse_iterator;
      61    typedef typename list_type::const_reverse_iterator const_reverse_iterator;
      62  }