+++ /dev/null
-//$$CDS-header$$
-
-#ifndef __CDS_DETAILS_HASH_FUNCTOR_SELECTOR_H
-#define __CDS_DETAILS_HASH_FUNCTOR_SELECTOR_H
-
-//@cond
-
-#if CDS_COMPILER == CDS_COMPILER_MSVC || CDS_COMPILER == CDS_COMPILER_INTEL
-# include <functional>
-#elif CDS_COMPILER == CDS_COMPILER_GCC || CDS_COMPILER == CDS_COMPILER_CLANG
- // GCC 4.3+
-# include <functional>
-#else
- // Default, use boost implementation
-# include <boost/tr1/functional.hpp>
-#endif
-
-namespace cds { namespace details {
-
-#if CDS_COMPILER == CDS_COMPILER_MSVC || CDS_COMPILER == CDS_COMPILER_INTEL
-# if _MSC_VER >= 1600
- // MSVC 2010 and above
- using std::hash;
-# define CDS_BEGIN_STD_HASH_NAMESPACE namespace std {
-# define CDS_END_STD_HASH_NAMESPACE }
-# define CDS_STD_HASH_NAMESPACE std
-# else
- // MSVC 2008
- using std::tr1::hash;
-# define CDS_BEGIN_STD_HASH_NAMESPACE namespace std { namespace tr1 {
-# define CDS_END_STD_HASH_NAMESPACE }}
-# define CDS_STD_HASH_NAMESPACE std::tr1
-# endif
-#elif CDS_COMPILER == CDS_COMPILER_GCC || CDS_COMPILER == CDS_COMPILER_CLANG
- // GCC 4.3+
- using std::hash;
-# define CDS_BEGIN_STD_HASH_NAMESPACE namespace std {
-# define CDS_END_STD_HASH_NAMESPACE }
-# define CDS_STD_HASH_NAMESPACE std
-#else
- // Default, use boost implementation
- using std::tr1::hash;
-# define CDS_BEGIN_STD_HASH_NAMESPACE namespace std { namespace tr1 {
-# define CDS_END_STD_HASH_NAMESPACE }}
-# define CDS_STD_HASH_NAMESPACE std::tr1
-#endif
-
-}} // namespace cds::details
-//@endcond
-
-#endif // __CDS_DETAILS_HASH_FUNCTOR_SELECTOR_H
// the heap is empty
m_Lock.unlock();
m_Stat.onPopFailed();
- return false;
+ return nullptr;
}
counter_type nBottom = m_ItemCounter.reversed_value();
m_ItemCounter.dec();
#define __CDS_OPT_HASH_H
#include <tuple>
+#include<functional>
#include <cds/opt/options.h>
-#include <cds/details/hash_functor_selector.h>
namespace cds { namespace opt {
/**
The metafunction selects appropriate hash functor implementation.
If \p Hash is not equal to opt::none, then result of metafunction is \p Hash.
- Otherwise, the result is <tt> std::hash<Q> </tt> or <tt> boost::hash<Q> </tt>
- depending of compiler you use.
+ Otherwise, the result is <tt> std::hash<Q> </tt>.
- Note that default hash function like <tt> std::hash<Q> </tt> or <tt> boost::hash<Q> </tt>
+ Note that default hash function like <tt> std::hash<Q> </tt>
is generally not suitable for complex type \p Q and its derivatives.
You should manually provide particular hash functor for such types.
*/
template <typename Q>
size_t operator()( Q const& key ) const
{
- return hash<Q>()( key );
+ return std::hash<Q>()( key );
}
};
};
//@cond
// At least, two functors must be provided. Single functor is not supported
-//#if CDS_COMPILER != CDS_COMPILER_INTEL
- // Intel C++ compiler does not support
template <typename Functor> struct hash< std::tuple<Functor> >;
-//#endif
//@endcond
/// Multi-functor hash option setter - specialization for std::tuple
template <typename... Functors>
struct hash< std::tuple<Functors...> >
{
-//# if CDS_COMPILER == CDS_COMPILER_INTEL
- //static_assert( sizeof...(Functors) > 1, "At least, two functors must be provided. Single functor is not supported" );
-//# endif
//@cond
template <typename Base> struct pack: public Base
{
<ClInclude Include="..\..\..\cds\details\binary_functor_wrapper.h" />\r
<ClInclude Include="..\..\..\cds\details\bit_reverse_counter.h" />\r
<ClInclude Include="..\..\..\cds\details\bounded_container.h" />\r
- <ClInclude Include="..\..\..\cds\details\hash_functor_selector.h" />\r
<ClInclude Include="..\..\..\cds\details\lib.h" />\r
<ClInclude Include="..\..\..\cds\details\numtraits.h" />\r
<ClInclude Include="..\..\..\cds\details\static_functor.h" />\r
<ClInclude Include="..\..\..\cds\details\bounded_container.h">\r
<Filter>Header Files\cds\details</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\..\cds\details\hash_functor_selector.h">\r
- <Filter>Header Files\cds\details</Filter>\r
- </ClInclude>\r
<ClInclude Include="..\..\..\cds\gc\all.h">\r
<Filter>Header Files\cds\gc</Filter>\r
</ClInclude>\r
// Pass The Buck (PTB) Memory manager implementation
+#include <algorithm> // std::fill
+#include <functional> // std::hash
+
#include <cds/gc/ptb/ptb.h>
#include <cds/algo/int_algo.h>
-#include <cds/details/hash_functor_selector.h>
-#include <algorithm> // std::fill
-
namespace cds { namespace gc { namespace ptb {
namespace details {
}
item_type& bucket( guard_data::guarded_ptr p )
{
- return m_Buckets[ cds::details::hash<guard_data::guarded_ptr>()( p ) & (m_nBucketCount - 1) ];
+ return m_Buckets[ std::hash<guard_data::guarded_ptr>()( p ) & (m_nBucketCount - 1) ];
}
public:
return false;
}
};
-} // namespace std
-
-CDS_BEGIN_STD_HASH_NAMESPACE
-template <>
-struct hash<map2::key_thread>
-{
- typedef size_t result_type;
- typedef map2::key_thread argument_type;
- size_t operator()(map2::key_thread const& k) const
- {
- return CDS_STD_HASH_NAMESPACE::hash<size_t>()( k.nKey );
- }
- size_t operator()(size_t k) const
+ template <>
+ struct hash<map2::key_thread>
{
- return CDS_STD_HASH_NAMESPACE::hash<size_t>()( k );
- }
-};
-CDS_END_STD_HASH_NAMESPACE
+ typedef size_t result_type;
+ typedef map2::key_thread argument_type;
-namespace boost {
- inline size_t hash_value( map2::key_thread const& k )
- {
- return CDS_STD_HASH_NAMESPACE::hash<size_t>()( k.nKey );
- }
+ size_t operator()( map2::key_thread const& k ) const
+ {
+ return std::hash<size_t>()(k.nKey);
+ }
+ size_t operator()( size_t k ) const
+ {
+ return std::hash<size_t>()(k);
+ }
+ };
+} // namespace std
+/*
+namespace boost {
template <>
struct hash<map2::key_thread>
{
}
};
} // namespace boost
+*/
namespace map2 {
return false;
}
};
-} // namespace std
-CDS_BEGIN_STD_HASH_NAMESPACE
template <>
struct hash<set2::key_thread>
{
typedef size_t result_type;
typedef set2::key_thread argument_type;
- size_t operator()(set2::key_thread const& k) const
+ size_t operator()( set2::key_thread const& k ) const
{
- return CDS_STD_HASH_NAMESPACE::hash<size_t>()( k.nKey );
+ return std::hash<size_t>()(k.nKey);
}
- size_t operator()(size_t k) const
+ size_t operator()( size_t k ) const
{
- return CDS_STD_HASH_NAMESPACE::hash<size_t>()( k );
+ return std::hash<size_t>()(k);
}
};
-CDS_END_STD_HASH_NAMESPACE
+} // namespace std
+
+/*
namespace boost {
inline size_t hash_value( set2::key_thread const& k )
{
- return CDS_STD_HASH_NAMESPACE::hash<size_t>()( k.nKey );
+ return std::hash<size_t>()( k.nKey );
}
template <>
}
};
} // namespace boost
-
+*/
namespace set2 {