/***************************** PDI STD File ***********************************
This file is taken from external sources. this is taken from open source uClibc++ 
library available on github. below is reference link. Thanking to author for
providing this .

This is free software. you can redistribute it and/or modify it but without any
warranty.

referred from   : https://github.com/mike-matera/ArduinoSTL
added Date      : 1st Dec 2024
added by        : Suraj I.
******************************************************************************/


#include "basic_definitions"


#ifndef __PDISTD_HEADER_UTILITY
#define __PDISTD_HEADER_UTILITY 1

#pragma GCC visibility push(default)

namespace pdistd{

	namespace rel_ops {
		template<class T> inline bool operator!=(const T& x, const T& y){
			return !(x == y);
		}

		template<class T> inline bool operator> (const T& x, const T& y){
			return ( y < x);
		}

		template<class T> inline bool operator<=(const T& x, const T& y){
			return !( y < x );
		}

		template<class T> inline bool operator>=(const T& x, const T& y){
			return !(x < y);
		}
	}

	template <class T1, class T2> struct _UCXXEXPORT pair {
		typedef T1 first_type;
		typedef T2 second_type;

		T1 first;
		T2 second;
		pair() : first(), second() {  }
		pair(const T1& x, const T2& y) : first(x), second(y) {  }
		template<class U, class V> pair(const pair<U, V> &p) : first(p.first), second(p.second) { }
	};
	
	template <class T1, class T2> bool operator==(const pair<T1,T2>& x, const pair<T1,T2>& y){
		using namespace rel_ops;
		return (x.first == y.first && x.second==y.second);
	}
	template <class T1, class T2> bool operator< (const pair<T1,T2>& x, const pair<T1,T2>& y){
		return x.first < y.first || (!(y.first < x.first) && x.second < y.second);
	}
	template <class T1, class T2> bool operator!=(const pair<T1,T2>& x, const pair<T1,T2>& y){
		return !(x == y);
	}
	template <class T1, class T2> bool operator> (const pair<T1,T2>& x, const pair<T1,T2>& y){
		return y < x;
	}
	template <class T1, class T2> bool operator>=(const pair<T1,T2>& x, const pair<T1,T2>& y){
		return !(x < y);
	}
	template <class T1, class T2> bool operator<=(const pair<T1,T2>& x, const pair<T1,T2>& y){
		return !(y < x);
	}
	template <class T1, class T2> pair<T1,T2> make_pair(const T1& x, const T2& y){
		return pair<T1,T2>(x, y);
	}

	// Stubb out move for compatibility
	template<class T>
	T& move(T& t) noexcept {
		return t;
	}
}

#pragma GCC visibility pop

#endif	//__PDISTD_HEADER_UTILITY
