Move all the boost/functional/hash/*.hpp files into a single file

(hash/hash.hpp for now, but will eventually move into hash.hpp), add warnings
that the old headers are deprecated.


[SVN r32778]
This commit is contained in:
Daniel James
2006-02-09 18:57:07 +00:00
parent 71641ebdcd
commit ffec55693b
14 changed files with 92 additions and 374 deletions

View File

@@ -15,11 +15,5 @@
#endif
#include <boost/functional/hash/hash.hpp>
#include <boost/functional/hash/pair.hpp>
#include <boost/functional/hash/vector.hpp>
#include <boost/functional/hash/list.hpp>
#include <boost/functional/hash/deque.hpp>
#include <boost/functional/hash/set.hpp>
#include <boost/functional/hash/map.hpp>
#endif

View File

@@ -14,31 +14,8 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class T, class A>
std::size_t hash_value(std::deque<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class T, class A>
struct call_hash<std::deque<T, A> >
{
static std::size_t call(std::deque<T, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/deque.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,31 +15,8 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class T, class A>
std::size_t hash_value(std::list<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class T, class A>
struct call_hash<std::list<T, A> >
{
static std::size_t call(std::list<T, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/list.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,47 +15,8 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
#include <boost/functional/hash/pair.hpp>
namespace boost
{
template <class K, class T, class C, class A>
std::size_t hash_value(std::map<K, T, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class T, class C, class A>
std::size_t hash_value(std::multimap<K, T, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class K, class T, class C, class A>
struct call_hash<std::map<K, T, C, A> >
{
static std::size_t call(std::map<K, T, C, A> const& val)
{
return boost::hash_value(val);
}
};
template <class K, class T, class C, class A>
struct call_hash<std::multimap<K, T, C, A> >
{
static std::size_t call(std::multimap<K, T, C, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/map.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,33 +15,7 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class A, class B>
std::size_t hash_value(std::pair<A, B> const& v)
{
std::size_t seed = 0;
hash_combine(seed, v.first);
hash_combine(seed, v.second);
return seed;
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class A, class B>
struct call_hash<std::pair<A, B> >
{
static std::size_t call(std::pair<A, B> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/pair.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,46 +15,8 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class K, class C, class A>
std::size_t hash_value(std::set<K, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class C, class A>
std::size_t hash_value(std::multiset<K, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class K, class C, class A>
struct call_hash<std::set<K, C, A> >
{
static std::size_t call(std::set<K, C, A> const& val)
{
return boost::hash_value(val);
}
};
template <class K, class C, class A>
struct call_hash<std::multiset<K, C, A> >
{
static std::size_t call(std::multiset<K, C, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/set.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,30 +15,7 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class T, class A>
std::size_t hash_value(std::vector<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class T, class A>
struct call_hash<std::vector<T, A> >
{
static std::size_t call(std::vector<T, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/vector.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -14,31 +14,8 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class T, class A>
std::size_t hash_value(std::deque<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class T, class A>
struct call_hash<std::deque<T, A> >
{
static std::size_t call(std::deque<T, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/deque.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -59,6 +59,23 @@ namespace boost
std::size_t hash_value(std::basic_string<Ch, std::char_traits<Ch>, A> const&);
#endif
template <class A, class B>
std::size_t hash_value(std::pair<A, B> const&);
template <class T, class A>
std::size_t hash_value(std::vector<T, A> const&);
template <class T, class A>
std::size_t hash_value(std::list<T, A> const& v);
template <class T, class A>
std::size_t hash_value(std::deque<T, A> const& v);
template <class K, class C, class A>
std::size_t hash_value(std::set<K, C, A> const& v);
template <class K, class C, class A>
std::size_t hash_value(std::multiset<K, C, A> const& v);
template <class K, class T, class C, class A>
std::size_t hash_value(std::map<K, T, C, A> const& v);
template <class K, class T, class C, class A>
std::size_t hash_value(std::multimap<K, T, C, A> const& v);
// Implementation
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
@@ -256,6 +273,57 @@ namespace boost
return boost::hash_detail::float_hash_value(v);
}
template <class A, class B>
std::size_t hash_value(std::pair<A, B> const& v)
{
std::size_t seed = 0;
hash_combine(seed, v.first);
hash_combine(seed, v.second);
return seed;
}
template <class T, class A>
std::size_t hash_value(std::vector<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class T, class A>
std::size_t hash_value(std::list<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class T, class A>
std::size_t hash_value(std::deque<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class C, class A>
std::size_t hash_value(std::set<K, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class C, class A>
std::size_t hash_value(std::multiset<K, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class T, class C, class A>
std::size_t hash_value(std::map<K, T, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class T, class C, class A>
std::size_t hash_value(std::multimap<K, T, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
// boost::hash
template <class T> struct hash

View File

@@ -15,31 +15,8 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class T, class A>
std::size_t hash_value(std::list<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class T, class A>
struct call_hash<std::list<T, A> >
{
static std::size_t call(std::list<T, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/list.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,47 +15,8 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
#include <boost/functional/hash/pair.hpp>
namespace boost
{
template <class K, class T, class C, class A>
std::size_t hash_value(std::map<K, T, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class T, class C, class A>
std::size_t hash_value(std::multimap<K, T, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class K, class T, class C, class A>
struct call_hash<std::map<K, T, C, A> >
{
static std::size_t call(std::map<K, T, C, A> const& val)
{
return boost::hash_value(val);
}
};
template <class K, class T, class C, class A>
struct call_hash<std::multimap<K, T, C, A> >
{
static std::size_t call(std::multimap<K, T, C, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/map.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,33 +15,7 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class A, class B>
std::size_t hash_value(std::pair<A, B> const& v)
{
std::size_t seed = 0;
hash_combine(seed, v.first);
hash_combine(seed, v.second);
return seed;
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class A, class B>
struct call_hash<std::pair<A, B> >
{
static std::size_t call(std::pair<A, B> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/pair.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,46 +15,8 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class K, class C, class A>
std::size_t hash_value(std::set<K, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
template <class K, class C, class A>
std::size_t hash_value(std::multiset<K, C, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class K, class C, class A>
struct call_hash<std::set<K, C, A> >
{
static std::size_t call(std::set<K, C, A> const& val)
{
return boost::hash_value(val);
}
};
template <class K, class C, class A>
struct call_hash<std::multiset<K, C, A> >
{
static std::size_t call(std::multiset<K, C, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/set.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif

View File

@@ -15,30 +15,7 @@
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/functional/hash/hash.hpp>
namespace boost
{
template <class T, class A>
std::size_t hash_value(std::vector<T, A> const& v)
{
return hash_range(v.begin(), v.end());
}
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
namespace hash_detail
{
template <class T, class A>
struct call_hash<std::vector<T, A> >
{
static std::size_t call(std::vector<T, A> const& val)
{
return boost::hash_value(val);
}
};
}
#endif
}
#warning "boost/functional/hash/vector.hpp is deprecated, use boost/functional/hash.hpp instead."
#include <boost/functional/hash.hpp>
#endif