/* simple example for using class array<> * * (C) Copyright Nicolai M. Josuttis 2001. * Permission to copy, use, modify, sell and distribute this software * is granted provided this copyright notice appears in all copies. * This software is provided "as is" without express or implied * warranty, and with no claim as to its suitability for any purpose. */ #include #include template void test_static_size (const T& cont) { int tmp[T::static_size]; for (unsigned i=0; i Array; // create and initialize an array const Array a = { { 42.42 } }; // use some common STL container operations std::cout << "static_size: " << a.size() << std::endl; std::cout << "size: " << a.size() << std::endl; std::cout << "empty: " << std::boolalpha << a.empty() << std::endl; std::cout << "max_size: " << a.max_size() << std::endl; std::cout << "front: " << a.front() << std::endl; std::cout << "back: " << a.back() << std::endl; std::cout << "[0]: " << a[0] << std::endl; std::cout << "elems: "; // iterate through all elements for (Array::const_iterator pos=a.begin(); pos DArray; typedef boost::array IArray; IArray ia = { 1, 2, 3, 4, 5, 6 }; DArray da; da = ia; da.assign(42); return 0; // makes Visual-C++ compiler happy }