ranges-minmax.hpp /usr/include/gecode/iter.hh Gecode::Iter::Ranges::MinMax Gecode Gecode::Iter Gecode::Iter::Ranges /*-*-mode:C++;c-basic-offset:2;indent-tabs-mode:nil-*-*/ /* *Mainauthors: *ChristianSchulte<schulte@gecode.org> * *Copyright: *ChristianSchulte,2004 * *Lastmodified: *$Date:2008-12-0516:43:57+0100(Fri,05Dec2008)$by$Author:schulte$ *$Revision:7989$ * *ThisfileispartofGecode,thegenericconstraint *developmentenvironment: *http://www.gecode.org * *Permissionisherebygranted,freeofcharge,toanypersonobtaining *acopyofthissoftwareandassociateddocumentationfiles(the *"Software"),todealintheSoftwarewithoutrestriction,including *withoutlimitationtherightstouse,copy,modify,merge,publish, *distribute,sublicense,and/orsellcopiesoftheSoftware,andto *permitpersonstowhomtheSoftwareisfurnishedtodoso,subjectto *thefollowingconditions: * *Theabovecopyrightnoticeandthispermissionnoticeshallbe *includedinallcopiesorsubstantialportionsoftheSoftware. * *THESOFTWAREISPROVIDED"ASIS",WITHOUTWARRANTYOFANYKIND, *EXPRESSORIMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIESOF *MERCHANTABILITY,FITNESSFORAPARTICULARPURPOSEAND *NONINFRINGEMENT.INNOEVENTSHALLTHEAUTHORSORCOPYRIGHTHOLDERSBE *LIABLEFORANYCLAIM,DAMAGESOROTHERLIABILITY,WHETHERINANACTION *OFCONTRACT,TORTOROTHERWISE,ARISINGFROM,OUTOFORINCONNECTION *WITHTHESOFTWAREORTHEUSEOROTHERDEALINGSINTHESOFTWARE. * */ namespaceGecode{namespaceIter{namespaceRanges{ classMinMax{ protected: intmi; intma; voidfinish(void); public: MinMax(void); MinMax(intmin,intmax); booloperator ()(void)const; intmin(void)const; intmax(void)const; unsignedintwidth(void)const; }; forceinlinevoid MinMax::finish(void){ mi=1;ma=0; } forceinline MinMax::MinMax(void){} forceinline MinMax::MinMax(intmin,intmax) :mi(min),ma(max){} forceinlinebool MinMax::operator ()(void)const{ returnmi<=ma; } forceinlineint MinMax::min(void)const{ returnmi; } forceinlineint MinMax::max(void)const{ returnma; } forceinlineunsignedint MinMax::width(void)const{ returnstatic_cast<unsignedint>(ma-mi)+1; } }}} //STATISTICS:iter-any