4 #include <boost/iterator/iterator_facade.hpp> 5 #include <boost/operators.hpp> 19 : boost::incrementable<
23 boost::multipliable<poly<T>, boost::multipliable2<poly<T>, T, boost::less_than_comparable<poly<T> > > > > > {
36 while (column !=
columns.end() && Rcolumn !=
R.columns.end() && *column == *Rcolumn) {
40 return column !=
columns.end() && Rcolumn !=
R.columns.end() && *column < *Rcolumn;
43 columns.push_back(std::set<T>());
59 columns.back().insert(
R.begin(),
R.end());
76 size *= column->size();
80 class const_iterator :
public boost::iterator_facade<const_iterator, T const, boost::bidirectional_traversal_tag, T> {
83 std::list<typename std::set<T>::const_iterator>
state;
86 typedef typename std::list<typename std::set<T>::const_iterator>::iterator
state_iterator;
99 while (column !=
end && ++*istate == column->end()) {
107 while (istate !=
state.begin()) {
109 *istate = (--column)->
begin();
115 while (column !=
end && *istate == column->begin()) {
121 while (istate !=
state.begin()) {
123 *istate = --((--column)->
end());
131 while (column !=
end)
137 *--(
it.state.end()) = (--
p.getColumns().end())->
end();
152 template <
class charT,
class traits,
class T>
153 inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& strm,
const poly<T>&
f) {
154 for (
auto const& column :
f.getColumns()) {
156 for (
auto const&
entry : column)
157 strm <<
entry <<
", ";
158 strm <<
" )" << std::endl;
bool operator<(const poly &R) const
const_iterator(const poly &p)
poly operator*=(const T &r)
std::list< std::set< T > >::const_iterator begin
auto const & getColumns() const
std::list< typename std::set< T >::const_iterator > state
poly operator+=(const poly &R)
bool equal(const T &first, const T &second)
std::list< std::set< T > > columns
std::list< typename std::set< T >::const_iterator >::const_iterator const_state_iterator
bool equal(const_iterator const &rhs) const
std::list< std::set< T > >::const_iterator const_column_iterator
std::list< typename std::set< T >::const_iterator >::iterator state_iterator
static const_iterator end_of(const poly &p)
poly< T > operator+(const poly< T > &, const char *)
const_iterator end() const
friend class boost::iterator_core_access
std::list< std::set< T > >::iterator column_iterator
const_iterator begin() const
poly operator*=(const poly &R)
poly operator+=(const T &r)
std::list< std::set< T > >::const_iterator end