/*************************************************************************** * tests/algo/test_sort_all_parameters.h * * Part of the STXXL. See http://stxxl.sourceforge.net * * Copyright (C) 2002 Roman Dementiev * Copyright (C) 2008, 2009 Andreas Beckmann * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) **************************************************************************/ #include #include #include template struct bulk { char m_data[n]; bulk() { #if STXXL_WITH_VALGRIND memset(m_data, 0, n); #endif } }; template <> struct bulk<0> { }; template struct my_type { typedef KEY key_type; key_type m_key; bulk m_data; my_type() { } my_type(key_type k) : m_key(k) { } #ifdef KEY_COMPARE key_type key() const { return m_key; } #endif static my_type min_value() { return my_type(std::numeric_limits::min()); } static my_type max_value() { return my_type(std::numeric_limits::max()); } }; template std::ostream& operator << (std::ostream& o, const my_type obj) { o << obj.m_key; return o; } #ifndef KEY_COMPARE template bool operator < (const my_type& a, const my_type& b) { return a.m_key < b.m_key; } template bool operator == (const my_type& a, const my_type& b) { return a.m_key == b.m_key; } template bool operator != (const my_type& a, const my_type& b) { return a.m_key != b.m_key; } template struct Cmp : public std::less { bool operator () (const T& a, const T& b) const { return a.m_key < b.m_key; } static T min_value() { return T::min_value(); } static T max_value() { return T::max_value(); } }; #else template bool operator < (const my_type& a, const my_type& b) { return a.key() < b.key(); } #endif struct zero { unsigned operator () () { return 0; } };