Sfoglia il codice sorgente

Allow ! and bool operators on polynomials.

This allows us to manipulate polynomials of polynomials. Not sure why yet,
but it could be useful to implement 2-variable polynomials.
legacy
Sam Hocevar 7 anni fa
parent
commit
1db2c5ca0f
1 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. +11
    -0
      src/lol/math/polynomial.h

+ 11
- 0
src/lol/math/polynomial.h Vedi File

@@ -274,6 +274,17 @@ struct LOL_ATTR_NODISCARD polynomial
return (*this)[degree()];
}

/* Boolean operations */
bool operator !() const
{
return degree() < 0;
}

operator bool() const
{
return !!*this;
}

/* Unary plus */
polynomial<T> operator +() const
{


Caricamento…
Annulla
Salva