Newer
Older
Scratch / lockwasher / src / sys / include / lib / Pair.h
@Christopher W. Olsen Christopher W. Olsen on 25 Oct 2019 532 bytes Scratch
#ifndef __CPP_PAIR_H
#define __CPP_PAIR_H

#ifdef __cplusplus

#include <ubixos/types.h>

template <class A, class B> class Pair
{
    protected:
	A a;
	B b;

    public:
	Pair() : a(), b() { };
	Pair(const A & _a, const B & _b) : a(_a), b(_b) { };

	~Pair() { };

	inline A & first() { return a; };
	inline B & second() { return b; };

	Pair & operator= (const Pair & right) {
	    this->first() = right.a;
	    this->second() = right.b;

	    return *this;
	}
    
	operator B() const
	{
	    return b;
	}
};


	
#endif
	
#endif