Compare commits

..

1 Commits

Author SHA1 Message Date
e9c54c0ad7 This commit was manufactured by cvs2svn to create tag
'Version_1_25_1'.

[SVN r11623]
2001-11-07 10:35:13 +00:00
6 changed files with 8 additions and 59 deletions

View File

@ -1,16 +1,9 @@
/* 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.
*
* Changelog:
* 20 Jan 2001 - Removed boolalpha use since stock GCC doesn't support it
* (David Abrahams)
*/
#include <iostream>
#include <boost/array.hpp>

View File

@ -1,11 +1,5 @@
/* 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 <algorithm>
#include <functional>
#include <boost/array.hpp>

View File

@ -1,11 +1,5 @@
/* 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 <string>
#include <iostream>
#include <boost/array.hpp>
@ -23,7 +17,7 @@ int main()
// copy and change order
boost::array<std::string,4> seasons_orig = seasons;
for (unsigned i=seasons.size()-1; i>0; --i) {
std::swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
}
std::cout << "one way: ";
@ -31,7 +25,7 @@ int main()
// try swap()
std::cout << "other way: ";
std::swap(seasons,seasons_orig);
swap(seasons,seasons_orig);
print_elements(seasons);
// try reverse iterators

View File

@ -1,11 +1,5 @@
/* 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 <algorithm>
#include <functional>
#include <string>

View File

@ -1,11 +1,5 @@
/* 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 <iostream>
#include <boost/array.hpp>
@ -16,8 +10,8 @@ void test_static_size (const T& cont)
for (unsigned i=0; i<T::static_size; ++i) {
tmp[i] = int(cont[i]);
}
for (unsigned j=0; j<T::static_size; ++j) {
std::cout << tmp[j] << ' ';
for (unsigned i=0; i<T::static_size; ++i) {
std::cout << tmp[i] << ' ';
}
std::cout << std::endl;
}
@ -33,8 +27,7 @@ int main()
// use some common STL container operations
std::cout << "static_size: " << a.size() << std::endl;
std::cout << "size: " << a.size() << std::endl;
// Can't use std::boolalpha because it isn't portable
std::cout << "empty: " << (a.empty()? "true" : "false") << 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;
@ -63,7 +56,7 @@ int main()
typedef boost::array<double,6> DArray;
typedef boost::array<int,6> IArray;
IArray ia = { { 1, 2, 3, 4, 5, 6 } } ; // extra braces silence GCC warning
IArray ia = { 1, 2, 3, 4, 5, 6 };
DArray da;
da = ia;
da.assign(42);

View File

@ -11,22 +11,16 @@
* This software is provided "as is" without express or implied
* warranty, and with no claim as to its suitability for any purpose.
*
* 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
* 05 Aug 2001 - minor update (Nico Josuttis)
* 20 Jan 2001 - STLport fix (Beman Dawes)
* 29 Sep 2000 - Initial Revision (Nico Josuttis)
*/
// See http://www.boost.org/libs/array for Documentation.
#ifndef BOOST_ARRAY_HPP
#define BOOST_ARRAY_HPP
#include <cstddef>
#include <stdexcept>
// Handles broken standard libraries better than <iterator>
#include <boost/detail/iterator.hpp>
#include <iterator>
#include <algorithm>
// FIXES for broken compilers
@ -56,15 +50,9 @@ namespace boost {
const_iterator end() const { return elems+N; }
// reverse iterator support
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
#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;
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
// workaround for broken reverse_iterator in VC7
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator,
reference, iterator, reference> > reverse_iterator;
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
const_reference, iterator, reference> > const_reverse_iterator;
#else
// workaround for broken reverse_iterator implementations
typedef std::reverse_iterator<iterator,T> reverse_iterator;
@ -166,10 +154,3 @@ namespace boost {
} /* namespace boost */
#endif /*BOOST_ARRAY_HPP*/