diff --git a/array.hpp.html b/array.hpp.html index fbb0dd3..964837b 100644 --- a/array.hpp.html +++ b/array.hpp.html @@ -19,16 +19,16 @@  * an STL container (as wrapper) for arrays of constant size.
 *
 * See
*      http://www.josuttis.com/cppcode
*      http://www.josuttis.com/cppcode
 * for details and the latest version.
 *
* (C) Copyright Nicolai M. Josuttis 1999.
* (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.
 *
* Sep 29, 2000
* Aug 05, 2001
 */
#ifndef BOOST_ARRAY_HPP
#define BOOST_ARRAY_HPP
@@ -65,11 +65,11 @@ namespace boost {
        const_iterator end() const { return elems+N; }

        // reverse iterator support
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
        typedef std::reverse_iterator<iterator> reverse_iterator;
        typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#else
-        // workaround for broken reverse_iterator implementations due to no partial specialization
+        // workaround for broken reverse_iterator implementations
        typedef std::reverse_iterator<iterator,T> reverse_iterator;
        typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
#endif
diff --git a/array.html b/array.html index c07ca87..2d913e3 100644 --- a/array.html +++ b/array.html @@ -205,7 +205,7 @@ (see Section 23.1, [lib.container.requirements] of the C++ Standard). The reasons array is not an reversible STL container is because:
- No constructors are provided
- - Elements may have an indetermined initial value (see below)
+ - Elements may have an undetermined initial value (see below)
- swap() has no constant complexity
- size() is always constant, based on the second template argument of the type
- The container provides no allocator support
@@ -278,37 +278,37 @@ as HTML file
  • as plain file
  • -

    Simple Example for using array<>: +

    array1.cpp, a simple example + for using array<>:

  • as HTML file
  • as plain file
  • -

    Another Example for using array<>: +

    array2.cpp, another example + for using array<>:

  • as HTML file
  • as plain file
  • -

    A third Example for using array<>: +

    array3.cpp, a third example + for using array<>:

  • as HTML file
  • as plain file
  • -

    An Example for using arrays - of arrays: +

    array4.cpp, an example for + using arrays of arrays:

  • as HTML file
  • as plain file
  • -

    An Example for testing other operations - of array<>: +

    array5.cpp, an example for + testing other operations of array<>:

  • as HTML file
  • as plain file
  • -

    All files -

  • as ZIP file - (24KB)
  • -
  • as TGZ file - (13KB)

    +
    + To find more details about using ordinary arrays in C++ and the framework of the STL, see e.g.
         The C++ diff --git a/array1.cpp b/array1.cpp index 814c9cd..6d937ab 100644 --- a/array1.cpp +++ b/array1.cpp @@ -40,12 +40,13 @@ int main() c = a; if (a==b && a==c) { std::cout << "copy construction and copy assignment are OK" - << std::endl; + << std::endl; } else { std::cout << "copy construction and copy assignment FAILED" - << std::endl; + << std::endl; } - return 0; + + return 0; // makes Visual-C++ compiler happy } diff --git a/array1.cpp.html b/array1.cpp.html index 1a9c061..1489e55 100644 --- a/array1.cpp.html +++ b/array1.cpp.html @@ -53,12 +53,14 @@ int main()
        c = a;
        if (a==b && a==c) {
            std::cout << "copy construction and copy assignment are OK"
    -           << std::endl;
    +                  << std::endl;
        }
        else {
            std::cout << "copy construction and copy assignment FAILED"
    -           << std::endl;
    +                  << std::endl;
        }
    +
    +    return 0;  // makes Visual-C++ compiler happy
    }

    diff --git a/array2.cpp b/array2.cpp index ef7ed17..c82ff5d 100644 --- a/array2.cpp +++ b/array2.cpp @@ -12,23 +12,24 @@ int main() // create and initialize array array a = { { 1, 2, 3, 4, 5 } }; - PRINT_ELEMENTS(a); + print_elements(a); // modify elements directly for (unsigned i=0; i()); // operation - PRINT_ELEMENTS(a); - return 0; + print_elements(a); + + return 0; // makes Visual-C++ compiler happy } diff --git a/array2.cpp.html b/array2.cpp.html index fe5a740..d2391c0 100644 --- a/array2.cpp.html +++ b/array2.cpp.html @@ -29,23 +29,25 @@ int main()
        // create and initialize array
        array<int,10> a = { { 1, 2, 3, 4, 5 } };

    -    PRINT_ELEMENTS(a);
    +    print_elements(a);

        // modify elements directly
        for (unsigned i=0; i<a.size(); ++i) {
            ++a[i];
        }
    -    PRINT_ELEMENTS(a);
    +    print_elements(a);

        // change order using an STL algorithm
        reverse(a.begin(),a.end());
    -    PRINT_ELEMENTS(a);
    +    print_elements(a);

        // negate elements using STL framework
        transform(a.begin(),a.end(),    // source
                  a.begin(),            // destination
                  negate<int>());       // operation
    -    PRINT_ELEMENTS(a);
    +    print_elements(a);
    +
    +    return 0;  // makes Visual-C++ compiler happy
    }

    diff --git a/array3.cpp b/array3.cpp index 0bb2a85..80ab475 100644 --- a/array3.cpp +++ b/array3.cpp @@ -35,7 +35,8 @@ int main() std::cout << " " << *pos; } std::cout << std::endl; - return 0; + + return 0; // makes Visual-C++ compiler happy } template diff --git a/array3.cpp.html b/array3.cpp.html index df4dd0f..ae4b7f7 100644 --- a/array3.cpp.html +++ b/array3.cpp.html @@ -52,6 +52,8 @@ int main()
            std::cout << " " << *pos;
        }
        std::cout << std::endl;
    +
    +    return 0;  // makes Visual-C++ compiler happy
    }

    template <class T>
    diff --git a/array4.cpp b/array4.cpp index 80884fd..346a39d 100644 --- a/array4.cpp +++ b/array4.cpp @@ -31,7 +31,8 @@ int main() // print last element of last array std::cout << "last element of last array: " << seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1] - << std::endl; - return 0; + << std::endl; + + return 0; // makes Visual-C++ compiler happy } diff --git a/array4.cpp.html b/array4.cpp.html index 92eb496..9f80d28 100644 --- a/array4.cpp.html +++ b/array4.cpp.html @@ -48,7 +48,9 @@ int main()
        // print last element of last array
        std::cout << "last element of last array: "
                  << seasons_i18n[seasons_i18n.size()-1][seasons_i18n[0].size()-1]
    -       << std::endl;
    +              << std::endl;
    +
    +    return 0;  // makes Visual-C++ compiler happy
    }

    diff --git a/array5.cpp b/array5.cpp index 235a633..c2de2d8 100644 --- a/array5.cpp +++ b/array5.cpp @@ -47,11 +47,11 @@ int main() c = a; if (a==b && a==c) { std::cout << "copy construction and copy assignment are OK" - << std::endl; + << std::endl; } else { - std::cout << "copy construction and copy assignment are OK" - << std::endl; + std::cout << "copy construction and copy assignment are BROKEN" + << std::endl; } typedef boost::array DArray; @@ -60,6 +60,7 @@ int main() DArray da; da = ia; da.assign(42); - return 0; + + return 0; // makes Visual-C++ compiler happy } diff --git a/array5.cpp.html b/array5.cpp.html index 1d89b0a..704a38a 100644 --- a/array5.cpp.html +++ b/array5.cpp.html @@ -64,11 +64,11 @@ int main()
        c = a;
        if (a==b && a==c) {
            std::cout << "copy construction and copy assignment are OK"
    -           << std::endl;
    +                  << std::endl;
        }
        else {
    -        std::cout << "copy construction and copy assignment are OK"
    -           << std::endl;
    +        std::cout << "copy construction and copy assignment are BROKEN"
    +                  << std::endl;
        }

        typedef boost::array<double,6> DArray;
    @@ -77,6 +77,8 @@ int main()
        DArray da;
        da = ia;
        da.assign(42);
    +
    +    return 0;  // makes Visual-C++ compiler happy
    }

    diff --git a/include/boost/array.hpp b/include/boost/array.hpp index 12621f7..0840003 100644 --- a/include/boost/array.hpp +++ b/include/boost/array.hpp @@ -5,12 +5,13 @@ * http://www.josuttis.com/cppcode * for details and the latest version. * - * (C) Copyright Nicolai M. Josuttis 1999. + * (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. * + * 05 Aug 2001 - minor update (Nico Josuttis) * 20 Jan 2001 - STLport fix (Beman Dawes) * 29 Sep 2000 - Initial Revision (Nico Josuttis) */ @@ -49,7 +50,7 @@ namespace boost { const_iterator end() const { return elems+N; } // reverse iterator support -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; #else diff --git a/print.hpp b/print.hpp index 4325f47..7ce0a2c 100644 --- a/print.hpp +++ b/print.hpp @@ -10,13 +10,13 @@ */ #include -/* PRINT_ELEMENTS() +/* print_elements() * - prints optional C-string optcstr followed by * - all elements of the collection coll * - separated by spaces */ template -inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="") +inline void print_elements (const T& coll, const char* optcstr="") { typename T::const_iterator pos; diff --git a/print.hpp.html b/print.hpp.html index c0aabaa..2afc947 100644 --- a/print.hpp.html +++ b/print.hpp.html @@ -26,13 +26,13 @@ #include <iostream>

    -/* PRINT_ELEMENTS()
    +/* print_elements()
     * - prints optional C-string optcstr followed by
     * - all elements of the collection coll
     * - separated by spaces
     */
    template <class T>
    -inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="")
    +inline void print_elements (const T& coll, const char* optcstr="")
    {
        typename T::const_iterator pos;