forked from boostorg/array
Added support Boost.Hash; checked in a test yesterday, but forgot to merge the actual code
[SVN r78581]
This commit is contained in:
@ -13,6 +13,7 @@
|
|||||||
* accompanying file LICENSE_1_0.txt or copy at
|
* accompanying file LICENSE_1_0.txt or copy at
|
||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
*
|
||||||
|
* 14 Apr 2012 - (mtc) Added support for boost::hash
|
||||||
* 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility.
|
* 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility.
|
||||||
* 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group.
|
* 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group.
|
||||||
* See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
|
* See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
|
||||||
@ -46,6 +47,7 @@
|
|||||||
// Handles broken standard libraries better than <iterator>
|
// Handles broken standard libraries better than <iterator>
|
||||||
#include <boost/detail/iterator.hpp>
|
#include <boost/detail/iterator.hpp>
|
||||||
#include <boost/throw_exception.hpp>
|
#include <boost/throw_exception.hpp>
|
||||||
|
#include <boost/functional/hash_fwd.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
// FIXES for broken compilers
|
// FIXES for broken compilers
|
||||||
@ -118,13 +120,13 @@ namespace boost {
|
|||||||
// operator[]
|
// operator[]
|
||||||
reference operator[](size_type i)
|
reference operator[](size_type i)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT( i < N && "out of range" );
|
BOOST_ASSERT_MSG( i < N, "out of range" );
|
||||||
return elems[i];
|
return elems[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
const_reference operator[](size_type i) const
|
const_reference operator[](size_type i) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT( i < N && "out of range" );
|
BOOST_ASSERT_MSG( i < N, "out of range" );
|
||||||
return elems[i];
|
return elems[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,6 +429,13 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
std::size_t hash_value(const array<T,N>& arr)
|
||||||
|
{
|
||||||
|
return boost::hash_range(arr.begin(), arr.end());
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace boost */
|
} /* namespace boost */
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user