Skip to content

Instantly share code, notes, and snippets.

@drewxa
Created January 20, 2018 17:54
Show Gist options
  • Save drewxa/900208ab7993985bfeb3e7b33bde96ef to your computer and use it in GitHub Desktop.
Save drewxa/900208ab7993985bfeb3e7b33bde96ef to your computer and use it in GitHub Desktop.
#pragma once
template <int P>
class Residue
{
public:
Residue(int a);
~Residue();
bool operator == (Residue<P> b) const;
bool operator < (Residue<P> b) const;
Residue<P>& operator += (Residue<P> b) const;
Residue<P>& operator -= (Residue<P> b) const;
Residue<P>& operator *= (Residue<P> b) const;
Residue<P>& operator /= (Residue<P> b) const;
// обратный по умножению
// если P состовное - бросить исключение
Residue<P>& operator ~ () const;
// обратный по сложению
Residue<P>& operator - () const;
private:
};
template <int P>
Residue<P> operator + (Residue<P> a, Residue<P> b);
template <int P>
Residue<P> operator - (Residue<P> a, Residue<P> b);
template <int P>
Residue<P> operator * (Residue<P> a, Residue<P> b);
template <int P>
Residue<P> operator / (Residue<P> a, Residue<P> b);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment