#ifndef H_CORAL_STRUCT_HELPERS
#define H_CORAL_STRUCT_HELPERS
// This file is part of the Coral project.
// Please read the copyright notice in the LICENSE file.

/*
 * Various help routines
 */


/*
 * Less than by strcmp() value
 */
template <class Key>
struct less_strcmp {
 public:
	bool operator()(const Key& x, const Key& y) const throw () {
		return strcmp(x, y) < 0;
	}
};

#if 0
// bah, use boost's reference_wrapper?
template <class T>
class ref_wrapper {
private:
	T* m_t;
public:
	ref_wrapper(T& t) : m_t(&t) { ; }
	ref_wrapper& operator=(const T& t) throw () {
		m_t = &t;
		return *this;
	}
	~ref_wrapper() throw () { ; }
	T& value() const throw () { return *m_t; }
	bool operator==(const ref_wrapper<T>& other) const throw () {
		return m_t == other.t;
	}
	bool operator!=(const ref_wrapper<T>& other) const throw () {
		return m_t != other.t;
	}
	bool operator<(const ref_wrapper<T>& other) const throw () {
		return m_t < other.t;
	}
	bool operator<=(const ref_wrapper<T>& other) const throw () {
		return m_t <= other.t;
	}
	bool operator>(const ref_wrapper<T>& other) const throw () {
		return m_t > other.t;
	}
	bool operator>=(const ref_wrapper<T>& other) const throw () { 
		return m_t >= other.m_t;
	}
};
#endif

#endif
