/* Example programs from the book Scientific and Engineering Programming in C++: An Introduction with Advanced Techniques and Examples, Addison-Wesley, 1994. (c) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 1994. ALL RIGHTS RESERVED. See README file for further details. */ #ifndef AbelianMonoidCategoryH #define AbelianMonoidCategoryH #include "Algebra/AbelianSemiGroupCategory.h" #include "Algebra/MonoidCommon.h" #include "Algebra/NonNegative.h" template class AbelianMonoidCategory : public AbelianSemiGroupCategory { public: // User Must Define: T& setToZero(); inline T& repeat(NonNegative n); static void identityElement(T& x) { x.setToZero(); } }; template inline T& AbelianMonoidCategory::repeat(NonNegative n) { return MonoidCommon >::repeatedComposition((T&) *this, n); } #endif