├── .gitignore ├── README ├── README.kindle ├── annotations ├── COPYING ├── INSTALL ├── INSTALL.im ├── README ├── README.PORTUGUESE ├── README.figures ├── README.legalese ├── README.newchapter ├── README.papersize ├── TODO ├── VERSION ├── bin │ ├── allcreate.aux │ ├── contentspage │ ├── createall │ ├── createhtml │ ├── createlatex │ ├── createlatexus │ ├── createpdf │ ├── createpostscript │ ├── createtxt │ ├── detab │ ├── htmlcontentspage │ ├── htmlindex │ ├── imagemove │ ├── latexarchive │ ├── latexonly │ ├── parentheses │ ├── patchhtml │ ├── patchhtmlindexentries │ ├── patchhtmlpre │ ├── patchlatexidx │ ├── patchlatexverb │ ├── ziphtml │ ├── ziplatex │ ├── ziptxt │ └── zipyo ├── build ├── changelog ├── compilers.im ├── contrib │ ├── classtemplates │ │ └── cloneable.h │ └── concrete │ │ └── refcountautoptr.h ├── contributions │ ├── FAQ │ ├── GGD.algorithm │ ├── README.makebook │ ├── chist.html │ ├── chist.pdf │ ├── chist.ps │ ├── cplusplus.pt_BR.odt.zip │ ├── cplusplus.pt_BR.pdf.zip │ ├── java_cpp_keywords.html │ ├── makebook.sh.gz │ ├── porter.scobey │ ├── s.bacchi │ └── sator.proton ├── esr.rejected ├── html │ ├── advancedtemplates │ │ └── multibase.gif │ ├── annotations.gif │ ├── classtemplates │ │ ├── converting.gif │ │ └── notfn.gif │ ├── containers │ │ ├── dellist.gif │ │ ├── insertlist.gif │ │ ├── list.gif │ │ ├── queue.gif │ │ └── stack │ │ │ └── stack.gif │ ├── cplusplus.opf │ ├── exceptions │ │ └── systemerror.gif │ ├── first │ │ └── datahiding.gif │ ├── functiontemplates │ │ └── selection.gif │ ├── inheritance │ │ └── hierarchy.gif │ ├── intro │ │ └── objects.gif │ ├── iostreams │ │ ├── ioclasses.gif │ │ └── sbbuffers.gif │ ├── memory │ │ ├── badassign.gif │ │ ├── fswap.gif │ │ ├── fswap2.gif │ │ └── rightass.gif │ ├── modaye │ ├── pointermembers │ │ ├── personfig.gif │ │ └── sizes.gif │ ├── polymorphism │ │ ├── ambiguity.gif │ │ ├── caumon.gif │ │ ├── implementation.gif │ │ ├── internal.gif │ │ ├── multivtable.gif │ │ └── virtbase.gif │ ├── sigfrank.shtml │ ├── stl │ │ └── heap.gif │ └── threading │ │ ├── compile.gif │ │ ├── sorting.gif │ │ └── time.gif ├── icmake │ ├── backtick │ ├── clean │ ├── cuteoln │ ├── distclean │ ├── docs │ ├── examples │ ├── findall │ ├── github │ ├── install │ ├── latex │ ├── log │ ├── loginstall │ ├── loglink │ ├── logzip │ ├── logzipr │ ├── man │ ├── mark │ ├── md │ ├── md5sum │ ├── pre │ ├── programs │ ├── readlog │ ├── remove │ ├── removedir │ ├── run │ ├── uninstall │ ├── verify │ ├── writelog │ └── zips ├── latex │ ├── advancedtemplates │ │ └── multibase.eps │ ├── classtemplates │ │ ├── converting.eps │ │ └── notfn.eps │ ├── containers │ │ ├── dellist.eps │ │ ├── insertlist.eps │ │ ├── list.eps │ │ ├── queue.eps │ │ └── stack │ │ │ └── stack.eps │ ├── cplusplus.sty │ ├── cplusplusus.sty │ ├── exceptions │ │ └── systemerror.eps │ ├── first │ │ └── datahiding.eps │ ├── functiontemplates │ │ └── selection.eps │ ├── inheritance │ │ └── hierarchy.eps │ ├── intro │ │ └── objects.eps │ ├── iostreams │ │ ├── ioclasses.eps │ │ └── sbbuffers.eps │ ├── memory │ │ ├── badassign.eps │ │ ├── fswap.eps │ │ ├── fswap2.eps │ │ └── rightass.eps │ ├── pointermembers │ │ ├── personfig.eps │ │ └── sizes.eps │ ├── polymorphism │ │ ├── ambiguity.eps │ │ ├── caumon.eps │ │ ├── implementation.eps │ │ ├── internal.eps │ │ ├── multivtable.eps │ │ └── virtbase.eps │ ├── stl │ │ └── heap.eps │ └── threading │ │ ├── compile.eps │ │ ├── sorting.eps │ │ └── time.eps ├── man │ └── c++-annotations.yo ├── pathbuild ├── pattern ├── required ├── scripts │ ├── htmlcontentspage │ ├── patchhtml │ ├── patchlatexidx │ └── patchlatexverb ├── single │ ├── index.html │ ├── legal.shtml │ └── target.shtml ├── src │ ├── htmlindex │ │ ├── aux │ │ │ ├── display.cc │ │ │ ├── getkeys.cc │ │ │ ├── head.cc │ │ │ ├── tail.cc │ │ │ └── usage.cc │ │ ├── build │ │ ├── htmlindex.cc │ │ ├── htmlindex.h │ │ ├── indexentry │ │ │ ├── indexentry.cc │ │ │ ├── indexentry.h │ │ │ ├── operatorless.cc │ │ │ └── showrefs.cc │ │ ├── man │ │ │ └── htmlindex.yo │ │ └── version.cc │ ├── keywordsort.cc │ ├── paren │ │ └── paren.cc │ ├── rmindexlines │ │ └── rmindexlines.cc │ ├── tab │ │ ├── flex.c │ │ ├── fname.c │ │ └── tab.c │ ├── tabs │ │ ├── CLASSES │ │ ├── VERSION │ │ ├── arguments.cc │ │ ├── data.cc │ │ ├── globals.h │ │ ├── icmconf │ │ ├── main.cc │ │ ├── main.ih │ │ ├── normalfile.cc │ │ ├── process.cc │ │ ├── tabber │ │ │ ├── detab.cc │ │ │ ├── entab.cc │ │ │ ├── frame │ │ │ ├── incColumn.cc │ │ │ ├── outspaces.cc │ │ │ ├── run.cc │ │ │ ├── run2.cc │ │ │ ├── space.cc │ │ │ ├── tab.cc │ │ │ ├── tabber.h │ │ │ ├── tabber.ih │ │ │ └── tabber1.cc │ │ ├── usage.cc │ │ └── version.cc │ ├── trim │ │ └── trim.cc │ └── verbnrs.cc ├── yo │ ├── abstract.yo │ ├── advancedtemplates.yo │ ├── advancedtemplates │ │ ├── aliases.yo │ │ ├── alternatives.yo │ │ ├── append.yo │ │ ├── availabletraits.yo │ │ ├── basenameresolution.yo │ │ ├── basictype.yo │ │ ├── classstructure.yo │ │ ├── concepts │ │ │ ├── example.yo │ │ │ ├── examples │ │ │ │ └── min.cc │ │ │ └── intro.yo │ │ ├── conversion.yo │ │ ├── designing.yo │ │ ├── destructor.yo │ │ ├── distinguish.yo │ │ ├── dottemplate.yo │ │ ├── erase.yo │ │ ├── eraseall.yo │ │ ├── erasedup.yo │ │ ├── erasefirst.yo │ │ ├── eraseindex.yo │ │ ├── errorcategory.yo │ │ ├── errorcode.yo │ │ ├── errorcondition.yo │ │ ├── example.yo │ │ ├── examples │ │ │ ├── append.OBS │ │ │ ├── append.h │ │ │ ├── basename1.cc │ │ │ ├── basename2.cc │ │ │ ├── basictraits.cc │ │ │ ├── basictraits.h │ │ │ ├── conversion.cc │ │ │ ├── conversion.h │ │ │ ├── erase.cc │ │ │ ├── erase.h │ │ │ ├── errcode.1 │ │ │ │ ├── CLASSES │ │ │ │ ├── calculatorerror │ │ │ │ │ ├── calculatorerror.h │ │ │ │ │ ├── calculatorerror.ih │ │ │ │ │ ├── data.cc │ │ │ │ │ ├── makeerrorcode.cc │ │ │ │ │ ├── message.cc │ │ │ │ │ └── name.cc │ │ │ │ ├── errorsource │ │ │ │ │ ├── data.cc │ │ │ │ │ ├── equivalent.cc │ │ │ │ │ ├── errorsource.h │ │ │ │ │ ├── errorsource.ih │ │ │ │ │ ├── makeerrorcondition.cc │ │ │ │ │ ├── message.cc │ │ │ │ │ └── name.cc │ │ │ │ ├── icmconf │ │ │ │ ├── main.cc │ │ │ │ ├── main.ih │ │ │ │ └── simulatorerror │ │ │ │ │ ├── data.cc │ │ │ │ │ ├── makeerrorcode.cc │ │ │ │ │ ├── message.cc │ │ │ │ │ ├── name.cc │ │ │ │ │ ├── simulatorerror.h │ │ │ │ │ └── simulatorerror.ih │ │ │ ├── errcode │ │ │ │ ├── CLASSES │ │ │ │ ├── calculatorcategory │ │ │ │ │ ├── calculatorcategory.h │ │ │ │ │ ├── calculatorcategory.ih │ │ │ │ │ ├── data.cc │ │ │ │ │ ├── instance.cc │ │ │ │ │ ├── makeerrorcode.cc │ │ │ │ │ ├── message.cc │ │ │ │ │ └── name.cc │ │ │ │ ├── calculatorerror │ │ │ │ │ └── calculatorerror.h │ │ │ │ ├── categorybase │ │ │ │ │ └── categorybase.h │ │ │ │ ├── catmap │ │ │ │ │ └── catmap.h │ │ │ │ ├── conditioncategory │ │ │ │ │ ├── conditioncategory.h │ │ │ │ │ ├── conditioncategory.ih │ │ │ │ │ ├── conditioncategory1.cc │ │ │ │ │ ├── data.cc │ │ │ │ │ ├── equivalent.cc │ │ │ │ │ ├── instance.cc │ │ │ │ │ ├── message.cc │ │ │ │ │ └── name.cc │ │ │ │ ├── errorcondition │ │ │ │ │ ├── addcondition.cc │ │ │ │ │ ├── data.cc │ │ │ │ │ ├── errorcondition.h │ │ │ │ │ ├── errorcondition.ih │ │ │ │ │ ├── errorcondition1.cc │ │ │ │ │ ├── functor.cc │ │ │ │ │ ├── instance.cc │ │ │ │ │ └── makeerrrorcondition.cc │ │ │ │ ├── icmconf │ │ │ │ ├── main.cc │ │ │ │ ├── main.ih │ │ │ │ ├── part │ │ │ │ │ └── main.cc │ │ │ │ ├── simulatorcategory │ │ │ │ │ ├── data.cc │ │ │ │ │ ├── instance.cc │ │ │ │ │ ├── makeerrorcode.cc │ │ │ │ │ ├── message.cc │ │ │ │ │ ├── name.cc │ │ │ │ │ ├── simulatorcategory.h │ │ │ │ │ └── simulatorcategory.ih │ │ │ │ └── simulatorerror │ │ │ │ │ └── simulatorerror.h │ │ │ ├── exprtempl.cc │ │ │ ├── exprtempl2.cc │ │ │ ├── exprtempl3.cc │ │ │ ├── inttype.h │ │ │ ├── listsearch.cc │ │ │ ├── listsearch.h │ │ │ ├── listsize.OBS │ │ │ ├── listsize.h │ │ │ ├── moving.cc │ │ │ ├── multi.cc │ │ │ ├── multi.h │ │ │ ├── newalloc.h │ │ │ ├── nulltype.h │ │ │ ├── outer.cc │ │ │ ├── perfect.cc │ │ │ ├── placementalloc.h │ │ │ ├── plainalloc.h │ │ │ ├── printf.cc │ │ │ ├── remove.h │ │ │ ├── storage.cc │ │ │ ├── storage.h │ │ │ ├── traits.cc │ │ │ ├── tuples.cc │ │ │ ├── typeat.cc │ │ │ ├── typeat.h │ │ │ ├── typelist.OBS │ │ │ ├── typelist.h │ │ │ ├── typetype.cc │ │ │ ├── typetype.h │ │ │ ├── uniq.OBS │ │ │ ├── uniq.h.OBS │ │ │ ├── userdefined.cc │ │ │ ├── variadic.cc │ │ │ ├── vector.cc │ │ │ └── vector0.cc │ │ ├── expressiontemplates.yo │ │ ├── implementing.yo │ │ ├── inheritance.yo │ │ ├── int2type.yo │ │ ├── intro.yo │ │ ├── iterating.yo │ │ ├── length.yo │ │ ├── listintro.yo │ │ ├── multi.yo │ │ ├── multibase.yo │ │ ├── noexcept.yo │ │ ├── nulltype.yo │ │ ├── overloaded.yo │ │ ├── policies.yo │ │ ├── returnnested.yo │ │ ├── search.yo │ │ ├── select.yo │ │ ├── structure.yo │ │ ├── subtle.yo │ │ ├── support.yo │ │ ├── templateparam.yo │ │ ├── templateparam2.yo │ │ ├── trait.yo │ │ ├── typetype.yo │ │ ├── userdefined.yo │ │ ├── using.yo │ │ ├── usingmulti.yo │ │ └── values.yo │ ├── classes.yo │ ├── classes │ │ ├── ambiguity.yo │ │ ├── anonymous.yo │ │ ├── application.yo │ │ ├── arguments.yo │ │ ├── comconst.yo │ │ ├── composition.yo │ │ ├── comref.yo │ │ ├── construc.yo │ │ ├── constructorscall.yo │ │ ├── defaulted.yo │ │ ├── defineinline.yo │ │ ├── examples │ │ │ ├── ambiguity.cc │ │ │ ├── constmembers.cc │ │ │ ├── delete.OBS │ │ │ ├── emptymain.cc │ │ │ ├── getmembers.cc │ │ │ ├── globalobject.cc │ │ │ ├── local.cc │ │ │ ├── order.cc │ │ │ ├── person.h │ │ │ ├── personconstr.cc │ │ │ ├── persondemo.cc │ │ │ ├── setmembers.cc │ │ │ └── volg.OBS │ │ ├── existingtypes.yo │ │ ├── headers.yo │ │ ├── inline.yo │ │ ├── inlinevars.yo │ │ ├── intro.yo │ │ ├── local.yo │ │ ├── member.yo │ │ ├── memberinit.yo │ │ ├── mutable.yo │ │ ├── namespaces.yo │ │ ├── order.yo │ │ ├── parentheses.yo │ │ ├── sizeof.yo │ │ ├── subtleties.yo │ │ ├── types.yo │ │ ├── uniforminit.yo │ │ ├── when2use.yo │ │ └── whennot2use.yo │ ├── classtemplates.yo │ ├── classtemplates │ │ ├── argdeduction.yo │ │ ├── boundfriends.yo │ │ ├── cirque.yo │ │ ├── cirqueexample.yo │ │ ├── cirquemembers.yo │ │ ├── cirqueuse.yo │ │ ├── concrete2template.yo │ │ ├── converting.yo │ │ ├── declaring.yo │ │ ├── default.yo │ │ ├── defining.yo │ │ ├── definitions.yo │ │ ├── derived.yo │ │ ├── examples │ │ │ ├── boundfriends.cc │ │ │ ├── buffer.cc │ │ │ ├── buffer.h │ │ │ ├── cirque.cc │ │ │ ├── cirque.h │ │ │ ├── cirquepartial.cc │ │ │ ├── cirquepartial.h │ │ │ ├── cirquevector.cc │ │ │ ├── cirquevector.h │ │ │ ├── concretefriends.cc │ │ │ ├── converting │ │ │ │ ├── main.cc │ │ │ │ └── main.ih │ │ │ ├── enumeration.cc.OBS │ │ │ ├── extern.cc │ │ │ ├── extern2.cc │ │ │ ├── forward2.cc │ │ │ ├── genlambda.cc │ │ │ ├── genlambda2.cc │ │ │ ├── instantiations.cc │ │ │ ├── iterator.h │ │ │ ├── iterators.cc │ │ │ ├── matrix.cc │ │ │ ├── matrix.h │ │ │ ├── matrixdecl.cc │ │ │ ├── nesting1.cc │ │ │ ├── notfn.cc │ │ │ ├── ptrfun.cc.OBS │ │ │ ├── resultof.cc │ │ │ ├── reverseiterators.cc │ │ │ ├── static.cc │ │ │ ├── staticpolymorphism │ │ │ │ ├── double.cc │ │ │ │ ├── multiple.cc │ │ │ │ └── polymorph.cc │ │ │ ├── statictype.cc │ │ │ ├── stringptr.h │ │ │ ├── stringptr1.h │ │ │ ├── table │ │ │ │ ├── build │ │ │ │ ├── keywords │ │ │ │ ├── table.cc │ │ │ │ ├── table.h │ │ │ │ ├── table │ │ │ │ │ ├── demo.cc │ │ │ │ │ └── table.h │ │ │ │ ├── tablesupport │ │ │ │ │ ├── destructor.cc │ │ │ │ │ ├── tablesupport.h │ │ │ │ │ ├── tablesupport.ih │ │ │ │ │ └── tablesupport1.cc │ │ │ │ └── tabletype │ │ │ │ │ ├── init.cc │ │ │ │ │ ├── insert.cc │ │ │ │ │ ├── opinsert.cc │ │ │ │ │ ├── setwidth.cc │ │ │ │ │ ├── tabletype.cc │ │ │ │ │ ├── tabletype.h │ │ │ │ │ ├── tabletype.ih │ │ │ │ │ └── tabletype2.cc │ │ │ ├── template2concrete.cc │ │ │ ├── template2template.cc │ │ │ ├── templatemember.cc │ │ │ ├── templatemembers.cc │ │ │ ├── tuples.cc │ │ │ ├── typename.OBS │ │ │ ├── unboundfriends.cc │ │ │ ├── variadic.OBS │ │ │ └── wrapper.OBS │ │ ├── examplestaticpoly.yo │ │ ├── explicit.yo │ │ ├── extended.yo │ │ ├── externtemplate.yo │ │ ├── fold.yo │ │ ├── friends.yo │ │ ├── instantiations.yo │ │ ├── intro.yo │ │ ├── iterator.yo │ │ ├── iteratorcons.yo │ │ ├── lambda.yo │ │ ├── matrix.yo │ │ ├── matrixalgebra.yo │ │ ├── matrixcol.yo │ │ ├── matrixrow.yo │ │ ├── members.yo │ │ ├── membertemplates.yo │ │ ├── nameresolution.yo │ │ ├── nesting.yo │ │ ├── nontype.yo │ │ ├── normalfriends.yo │ │ ├── onebyone.yo │ │ ├── partial.yo │ │ ├── perfect.yo │ │ ├── randomiterator.yo │ │ ├── references.yo.OBS │ │ ├── returntype.yo │ │ ├── reverseiterator.yo │ │ ├── simple.yo │ │ ├── specialization.yo │ │ ├── static.yo │ │ ├── staticpoly.yo │ │ ├── template2concrete.yo │ │ ├── template2template.yo │ │ ├── tuples.yo │ │ ├── typename.yo │ │ ├── unboundfriends.yo │ │ ├── unpack.yo │ │ ├── using.yo │ │ ├── variadic.yo │ │ ├── variadicnontype.yo │ │ └── vector │ │ │ ├── bidirectionaliterator.cc │ │ │ ├── boundfriend.cc │ │ │ ├── forwarditerator.cc │ │ │ ├── inputiterator.cc │ │ │ ├── instantiate.cc │ │ │ ├── main.cc │ │ │ ├── outputiterator.cc │ │ │ ├── pushback.cc │ │ │ ├── randomaccessiterator.cc │ │ │ ├── reverse.h │ │ │ ├── vector1.cc │ │ │ ├── vector1.h │ │ │ └── vector_stl.h │ ├── concrete.yo │ ├── concrete │ │ ├── a2x.yo │ │ ├── access.yo │ │ ├── addtypes.yo │ │ ├── basicfork.yo │ │ ├── binop.yo │ │ ├── bison.yo │ │ ├── bisonc++ │ │ │ ├── build │ │ │ ├── calculator.cc │ │ │ ├── parser │ │ │ │ ├── display1.cc │ │ │ │ ├── display2.cc │ │ │ │ ├── done.cc │ │ │ │ ├── grammar │ │ │ │ ├── parser.h │ │ │ │ ├── parser.ih │ │ │ │ └── reset.cc │ │ │ └── scanner │ │ │ │ ├── lexer │ │ │ │ ├── scanner.h │ │ │ │ └── scanner.ih │ │ ├── bisonflex.yo │ │ ├── bisonflexspec.yo │ │ ├── child.yo │ │ ├── children.yo │ │ ├── codegeneration.yo │ │ ├── command.yo │ │ ├── crtp.yo │ │ ├── daemon.yo │ │ ├── definition.yo │ │ ├── examples │ │ │ ├── a2x.cc │ │ │ ├── a2x.h │ │ │ ├── a2xis.cc │ │ │ ├── binopclasses.cc │ │ │ ├── bitand.h.OFF │ │ │ ├── bitfunctional │ │ │ ├── bitnot.h.OFF │ │ │ ├── buildslurp │ │ │ ├── command.OBS │ │ │ ├── command.h │ │ │ ├── daemon.cc │ │ │ ├── fdinseek.cc │ │ │ ├── fdinseek.h │ │ │ ├── fdout.cc │ │ │ ├── fdout.h │ │ │ ├── fdunget.cc │ │ │ ├── fdunget.h │ │ │ ├── fistream │ │ │ │ ├── fisin │ │ │ │ ├── fistream.cc │ │ │ │ ├── fistream.h │ │ │ │ ├── fistream.ih │ │ │ │ └── main.cc │ │ │ ├── for1.OBS │ │ │ ├── for2.cc │ │ │ ├── for3.cc │ │ │ ├── foreach.OBS │ │ │ ├── foreach.h │ │ │ ├── foreachdemo.cc │ │ │ ├── foreachfbbdemo.OBS │ │ │ ├── fork.cc │ │ │ ├── fork.h │ │ │ ├── fork.ih │ │ │ ├── forkvirtual.cc │ │ │ ├── ifdbuf.cc │ │ │ ├── ifdbuf.h │ │ │ ├── ifdnbuf.cc │ │ │ ├── ifdnbuf.h │ │ │ ├── ipipe.h │ │ │ ├── iterator.h │ │ │ ├── iterators.cc │ │ │ ├── iterators │ │ │ │ ├── bidirectional.cc │ │ │ │ ├── bidirectional.h │ │ │ │ ├── forward.cc │ │ │ │ ├── forward.h │ │ │ │ ├── input.cc │ │ │ │ ├── input.h │ │ │ │ ├── iterator.h │ │ │ │ ├── output.cc │ │ │ │ ├── output.h │ │ │ │ ├── random.cc │ │ │ │ └── random.h │ │ │ ├── lines.cc │ │ │ ├── lines.h │ │ │ ├── lines0.h │ │ │ ├── monitor │ │ │ │ ├── build │ │ │ │ ├── child.cc │ │ │ │ ├── child.h │ │ │ │ ├── createnewchild.cc │ │ │ │ ├── data.compiletime │ │ │ │ ├── main.cc │ │ │ │ ├── monitor.cc │ │ │ │ ├── monitor.h │ │ │ │ ├── monitor.ih │ │ │ │ ├── processchild.cc │ │ │ │ ├── processinput.cc │ │ │ │ ├── run.cc │ │ │ │ ├── sendchild.cc │ │ │ │ ├── stopchild.cc │ │ │ │ └── unknown.cc │ │ │ ├── noredir.cc │ │ │ ├── oformstream.cc │ │ │ ├── oformstream.h │ │ │ ├── parentslurp.cc │ │ │ ├── parentslurp.h │ │ │ ├── pipe.cc │ │ │ ├── pipe.h │ │ │ ├── predfun.cc │ │ │ ├── predicates.h │ │ │ ├── predobj.cc │ │ │ ├── removeodd.cc.OFF │ │ │ ├── rsh.cc │ │ │ ├── selector.cc │ │ │ ├── selector.h │ │ │ ├── stringptr.h │ │ │ └── waitforchild.cc │ │ ├── fdinbuf.yo │ │ ├── fdinput.yo │ │ ├── fdinseek.yo │ │ ├── fdninbuf.yo │ │ ├── fdout.yo │ │ ├── fdunget.yo │ │ ├── fistream.yo │ │ ├── fistreamexample.yo │ │ ├── foreach.OBS │ │ ├── fork.yo │ │ ├── fork2 │ │ │ ├── build │ │ │ ├── childprocess │ │ │ │ ├── childprocess.h │ │ │ │ ├── childprocess.ih │ │ │ │ └── run.cc │ │ │ ├── cinredirector │ │ │ │ ├── childredirections.cc │ │ │ │ ├── cinredirector.h │ │ │ │ ├── cinredirector.ih │ │ │ │ └── parentredirections.cc │ │ │ ├── fork │ │ │ │ ├── fork.h │ │ │ │ ├── fork.ih │ │ │ │ └── forkfork.cc │ │ │ ├── ifdnstreambuf │ │ │ │ ├── destructor.cc │ │ │ │ ├── ifdnstreambuf.h │ │ │ │ ├── ifdnstreambuf.ih │ │ │ │ ├── open.cc │ │ │ │ ├── underflow.cc │ │ │ │ └── xsgetn.cc │ │ │ ├── ipipe │ │ │ │ └── ipipe.h │ │ │ ├── ofdnstreambuf │ │ │ │ ├── destructor.cc │ │ │ │ ├── ofdnstreambuf.h │ │ │ │ ├── ofdnstreambuf.ih │ │ │ │ ├── open.cc │ │ │ │ ├── overflow.cc │ │ │ │ └── sync.cc │ │ │ ├── opipe │ │ │ │ ├── opipe.cc │ │ │ │ ├── opipe.h │ │ │ │ └── opipe.ih │ │ │ ├── parentprocess │ │ │ │ └── parentprocess.h │ │ │ ├── pipe │ │ │ │ ├── driver │ │ │ │ │ ├── build │ │ │ │ │ ├── driver.cc │ │ │ │ │ └── driver.h │ │ │ │ ├── dup.cc │ │ │ │ ├── pipe.cc │ │ │ │ ├── pipe.h │ │ │ │ ├── pipe.ih │ │ │ │ ├── readvia.cc │ │ │ │ ├── readvia2.cc │ │ │ │ ├── writevia.cc │ │ │ │ └── writevia2.cc │ │ │ └── redirector │ │ │ │ └── redirector.h │ │ ├── header.yo │ │ ├── insertion.yo │ │ ├── intro.yo │ │ ├── iterators.yo │ │ ├── lexer.yo │ │ ├── lexer │ │ │ ├── build │ │ │ ├── in.1 │ │ │ ├── in.2 │ │ │ ├── lexer.cc │ │ │ ├── lexer.ih │ │ │ └── scanner │ │ │ │ ├── lexer │ │ │ │ ├── scanner.h │ │ │ │ ├── scanner.ih │ │ │ │ └── switchsource.cc │ │ ├── lexerspec.yo │ │ ├── lvalues │ │ │ └── lvalues.cc │ │ ├── monitor.yo │ │ ├── monitorexample.yo │ │ ├── mutable.yo │ │ ├── namespace.yo │ │ ├── oformstream.yo │ │ ├── operators.yo │ │ ├── parents.yo │ │ ├── parentslurp.yo │ │ ├── parser.yo │ │ ├── parserh.yo │ │ ├── pipes.yo │ │ ├── poly │ │ │ ├── base │ │ │ │ ├── base.h │ │ │ │ ├── base.ih │ │ │ │ └── clone.cc │ │ │ ├── icmconf │ │ │ ├── input │ │ │ ├── int │ │ │ │ └── int.h │ │ │ ├── main.cc │ │ │ ├── main.ih │ │ │ ├── parser │ │ │ │ ├── grammar │ │ │ │ ├── parser.h │ │ │ │ ├── parser.ih │ │ │ │ └── preinclude.h │ │ │ ├── scanner │ │ │ │ ├── lexer │ │ │ │ ├── scanner.h │ │ │ │ └── scanner.ih │ │ │ ├── semantic │ │ │ │ └── semantic.h │ │ │ └── text │ │ │ │ └── text.h │ │ ├── poly2 │ │ │ ├── build │ │ │ ├── input │ │ │ ├── main.cc │ │ │ ├── main.ih │ │ │ ├── parser │ │ │ │ ├── display.cc │ │ │ │ ├── grammar │ │ │ │ ├── parser.h │ │ │ │ └── parser.ih │ │ │ ├── scanner │ │ │ │ ├── lexer │ │ │ │ ├── scanner.h │ │ │ │ └── scanner.ih │ │ │ ├── sembase │ │ │ │ ├── destructor.cc │ │ │ │ └── sembase.h │ │ │ └── spsembase │ │ │ │ └── spsembase.h │ │ ├── polygram.yo │ │ ├── polymorphic.yo │ │ ├── predicates.yo │ │ ├── promotions.yo │ │ ├── proxy.yo │ │ ├── ranger.yo │ │ ├── redirection.yo │ │ ├── rules.yo │ │ ├── run.yo │ │ ├── scancompile.yo │ │ ├── scanmain.yo │ │ ├── scanner.yo │ │ ├── select.yo │ │ ├── selectimpl.yo │ │ ├── semantic.yo │ │ ├── sembase.yo │ │ ├── semscanner.yo │ │ ├── shandler.yo │ │ ├── spsembase.yo │ │ ├── streambuf │ │ │ └── fdstreambuf │ │ │ │ ├── fbinbufn.cc │ │ │ │ ├── fdin2cout.cc │ │ │ │ ├── fdinbuf100.cc │ │ │ │ ├── fdinextracttocout.cc │ │ │ │ ├── fdinmininum.cc │ │ │ │ ├── fdinputback.cc │ │ │ │ ├── fdinrdbuf.cc │ │ │ │ ├── fdinseek.cc │ │ │ │ ├── fdstreambuf.h │ │ │ │ ├── fdstreambuf.h0 │ │ │ │ ├── inok │ │ │ │ ├── buf.n.h │ │ │ │ ├── minimum.h │ │ │ │ └── seek.1.h │ │ │ │ └── input │ │ ├── tag.yo │ │ ├── tagtrait.yo │ │ ├── unrestricted.yo │ │ ├── unrestricted │ │ │ ├── CLASSES │ │ │ ├── icmconf │ │ │ ├── input │ │ │ ├── main.cc │ │ │ ├── main.ih │ │ │ ├── parser │ │ │ │ ├── grammar │ │ │ │ ├── parser.h │ │ │ │ ├── parser.ih │ │ │ │ └── preinclude.h │ │ │ ├── scanner │ │ │ │ ├── lexer │ │ │ │ ├── scanner.h │ │ │ │ └── scanner.ih │ │ │ └── semantic │ │ │ │ ├── destructor.cc │ │ │ │ ├── operatorassign.cc │ │ │ │ ├── operatorinsert.cc │ │ │ │ ├── semantic.h │ │ │ │ ├── semantic.ih │ │ │ │ ├── semantic1.cc │ │ │ │ ├── semantic2.cc │ │ │ │ └── swap.cc │ │ ├── usingbison.yo │ │ └── usingflex.yo │ ├── containers.yo │ ├── containers │ │ ├── allocator.yo │ │ ├── array.yo │ │ ├── assignment.yo │ │ ├── ccandmove.yo │ │ ├── complex.yo │ │ ├── container.yo │ │ ├── dellist.fig │ │ ├── deque.yo │ │ ├── destroying.yo │ │ ├── embedding.yo │ │ ├── examples │ │ │ ├── allocator.cc │ │ │ ├── complexstack.cc │ │ │ ├── hash.cc │ │ │ ├── hash2.cc │ │ │ ├── hashclasses.h │ │ │ ├── listhashmapErase2.OBS │ │ │ ├── listhashmaperase.OBS │ │ │ ├── listmaperase.OBS │ │ │ ├── listmerge.cc │ │ │ ├── listremove.cc │ │ │ ├── listsplice.cc │ │ │ ├── listunique.cc │ │ │ ├── mapbounds.cc │ │ │ ├── mapconstruct.cc │ │ │ ├── mapfind.cc │ │ │ ├── mapinsert.cc │ │ │ ├── maptable.cc │ │ │ ├── multimap.cc │ │ │ ├── multiset.cc │ │ │ ├── prioritywords1.cc │ │ │ ├── prioritywords2.cc │ │ │ ├── regex.OBS │ │ │ ├── unrestricted.cc │ │ │ ├── unrestricted2.cc │ │ │ └── vector.cc │ │ ├── hashmap.OBS │ │ │ └── hashmap.cc │ │ ├── heterogeneous.yo │ │ ├── insertlist.fig │ │ ├── list.fig │ │ ├── list.yo │ │ ├── map.yo │ │ ├── map2 │ │ ├── mapconstructors.yo │ │ ├── mapexample.yo │ │ ├── mapmembers.yo │ │ ├── mapoperators.yo │ │ ├── multimap.yo │ │ ├── multiset.yo │ │ ├── notations.yo │ │ ├── pair.yo │ │ ├── priority.yo │ │ ├── queue.fig │ │ ├── queue.yo │ │ ├── queue │ │ │ └── front.cc │ │ ├── set.yo │ │ ├── set │ │ │ └── insert.cc │ │ ├── stack.yo │ │ ├── stack │ │ │ └── stack.fig │ │ ├── uniondestructor.yo │ │ ├── unorderedmap.yo │ │ ├── unorderedmapconstructors.yo │ │ ├── unorderedmapmembers.yo │ │ ├── unorderedmultimap.yo │ │ ├── unorderedmultiset.yo │ │ ├── unorderedset.yo │ │ ├── unrestricted.yo │ │ └── vector.yo │ ├── cplusplus.css │ ├── cplusplus.idx │ ├── cplusplus.yo │ ├── exceptions.yo │ ├── exceptions │ │ ├── basic.yo │ │ ├── catch.yo │ │ ├── compiling.obs │ │ ├── constructors.yo │ │ ├── declaring.yo │ │ ├── defaultcatch.yo │ │ ├── demo.cc │ │ ├── emptythrow.yo │ │ ├── errorcategory.yo │ │ ├── errorcode.yo │ │ ├── errorcondition.yo │ │ ├── example.yo │ │ ├── examples │ │ │ ├── basic.cc │ │ │ ├── catchers.cc │ │ │ ├── constructor.cc │ │ │ ├── defaultcatch.cc │ │ │ ├── destructor.cc │ │ │ ├── emptythrow.cc │ │ │ ├── errorcode.cc │ │ │ ├── exception.cc │ │ │ ├── function.cc │ │ │ ├── ioexceptions.cc │ │ │ ├── jmp.cc │ │ │ ├── plain.cc │ │ │ ├── systemerror.cc │ │ │ ├── throw.cc │ │ │ └── throwlist.cc │ │ ├── exception.yo │ │ ├── function.yo │ │ ├── guarantees.yo │ │ ├── intro.yo │ │ ├── iostreams.yo │ │ ├── jmp.yo │ │ ├── noexcept.yo │ │ ├── nothrow.yo │ │ ├── notry.cc │ │ ├── standard.yo │ │ ├── strong.yo │ │ ├── syntax.yo │ │ ├── systemerror.yo │ │ ├── systemerroruse.yo │ │ ├── throw.yo │ │ ├── try.yo │ │ └── usestandard.yo │ ├── first.yo │ ├── first │ │ ├── attributes.yo │ │ ├── auto.yo │ │ ├── binary.yo │ │ ├── binding.yo │ │ ├── bool.yo │ │ ├── cast.yo │ │ ├── const.yo │ │ ├── constcast.yo │ │ ├── cout.yo │ │ ├── cvscpp.yo │ │ ├── datatypes.yo │ │ ├── dynamiccast.yo │ │ ├── examples │ │ │ ├── initializer.cc │ │ │ ├── rvalueref.cc │ │ │ └── structured.cc │ │ ├── extensions.yo │ │ ├── first.yo │ │ ├── initializer.yo │ │ ├── keywords.yo │ │ ├── longlongint.yo │ │ ├── lvalues.yo │ │ ├── namespaces.yo │ │ ├── public.yo │ │ ├── rangebased.yo │ │ ├── rawstring.yo │ │ ├── references.yo │ │ ├── reinterpretcast.yo │ │ ├── rvalueref.yo │ │ ├── scope.yo │ │ ├── selectinit.yo │ │ ├── separators.yo │ │ ├── sharedcast.yo │ │ ├── sizet.yo │ │ ├── staticcast.yo │ │ ├── stronglytyped.yo │ │ ├── structs.yo │ │ ├── unicode.yo │ │ ├── using.yo │ │ └── wchar.yo │ ├── freelectures.yo │ ├── friends.yo │ ├── friends │ │ ├── extended.yo │ │ ├── friendfun.yo │ │ └── intro.yo │ ├── functiontemplates.yo │ ├── functiontemplates │ │ ├── algorithm.yo │ │ ├── alternate.yo │ │ ├── ambiguities.yo │ │ ├── argumentdeduction.yo │ │ ├── autodecl.yo │ │ ├── avoiding.yo │ │ ├── baseclass.yo │ │ ├── cc.OBS │ │ │ ├── candidates.cc │ │ │ ├── candidates.h │ │ │ ├── cast.cc │ │ │ ├── differentsigns.h │ │ │ ├── explicit.cc │ │ │ ├── fun1.cc │ │ │ ├── fun2.cc │ │ │ ├── instantiate.cc │ │ │ ├── instantiatedecl.cc │ │ │ ├── instantiatefirst.cc │ │ │ ├── main1.cc │ │ │ ├── nocompile.cc │ │ │ ├── outerproduct.h │ │ │ ├── overloadfunction.h │ │ │ ├── pointerunion.h │ │ │ ├── specialization.cc │ │ │ ├── specialization.h │ │ │ └── sumqueue.h │ │ ├── considerations.yo │ │ ├── contractions.yo │ │ ├── declarations.yo │ │ ├── declaring.yo │ │ ├── declaringspec.yo │ │ ├── definitions.yo │ │ ├── determining.yo │ │ ├── example.yo │ │ ├── examples │ │ │ ├── add.h │ │ │ ├── add2.h │ │ │ ├── ambiguous.cc │ │ │ ├── ambiguous2.cc │ │ │ ├── cast.cc │ │ │ ├── decltype.cc │ │ │ ├── explicit.cc │ │ │ ├── lambdaconstexpr.cc │ │ │ ├── lvalue.cc │ │ │ ├── main.cc │ │ │ ├── pointerunion.h │ │ │ ├── refwrap.cc │ │ │ ├── selection.OBS │ │ │ ├── source1.cc │ │ │ ├── source2.cc │ │ │ └── staticassert.cc │ │ ├── explicit.yo │ │ ├── ifconst.yo │ │ ├── insertion.yo │ │ ├── instantdecl.yo │ │ ├── instantiations.yo │ │ ├── intro.yo │ │ ├── limits.yo │ │ ├── local.yo │ │ ├── lvalue.yo │ │ ├── nameresolution.yo │ │ ├── nocodebloat.yo │ │ ├── overloading.yo │ │ ├── polymorphouswrappers.yo │ │ ├── qualifications.yo │ │ ├── referencewrappers.yo │ │ ├── selection.yo │ │ ├── sfinae.yo │ │ ├── specialization.yo │ │ ├── staticassertions.yo │ │ ├── summary.yo │ │ └── variables.yo │ ├── generic.yo │ ├── generic │ │ ├── accumulate.yo │ │ ├── adaptablefunctions.OBS │ │ ├── adjacentdifference.yo │ │ ├── adjacentfind.yo │ │ ├── binarysearch.yo │ │ ├── copy.yo │ │ ├── copybackward.yo │ │ ├── count.yo │ │ ├── countif.yo │ │ ├── equal.yo │ │ ├── equalrange.yo │ │ ├── examples │ │ │ ├── accumulate.cc │ │ │ ├── adjacentdifference.cc │ │ │ ├── adjacentfind.cc │ │ │ ├── binarysearch.cc │ │ │ ├── copy.cc │ │ │ ├── copybackward.cc │ │ │ ├── count.cc │ │ │ ├── countif.cc │ │ │ ├── equal.cc │ │ │ ├── equalrange.cc │ │ │ ├── exchange.cc │ │ │ ├── fill.cc │ │ │ ├── filln.cc │ │ │ ├── find.cc │ │ │ ├── findend.cc │ │ │ ├── findfirstof.cc │ │ │ ├── findif.cc │ │ │ ├── foreach.cc │ │ │ ├── foreachclass.cc │ │ │ ├── generate.cc │ │ │ ├── generaten.cc │ │ │ ├── heap.cc │ │ │ ├── includes.cc │ │ │ ├── innerproduct.cc │ │ │ ├── inplacemerge.cc │ │ │ ├── iterswap.cc │ │ │ ├── lexicographicalcompare.cc │ │ │ ├── lowerbound.cc │ │ │ ├── max.cc │ │ │ ├── maxelement.cc │ │ │ ├── merge.cc │ │ │ ├── min.cc │ │ │ ├── minelement.cc │ │ │ ├── mismatch.cc │ │ │ ├── nextpermutation.cc │ │ │ ├── nthelement.cc │ │ │ ├── partialsort.cc │ │ │ ├── partialsortcopy.cc │ │ │ ├── partialsum.cc │ │ │ ├── partition.cc │ │ │ ├── prevpermutation.cc │ │ │ ├── ptrfun.cc │ │ │ ├── randomshuffle.cc.OBS │ │ │ ├── remove.cc │ │ │ ├── removecopy.cc │ │ │ ├── removecopyif.cc │ │ │ ├── removeif.cc │ │ │ ├── replace.cc │ │ │ ├── replacecopy.cc │ │ │ ├── replacecopyif.cc │ │ │ ├── replaceif.cc │ │ │ ├── reverse.cc │ │ │ ├── reversecopy.cc │ │ │ ├── rotate.cc │ │ │ ├── rotatecopy.cc │ │ │ ├── search.cc │ │ │ ├── searchn.cc │ │ │ ├── setdifference.cc │ │ │ ├── setintersection.cc │ │ │ ├── setsymmetricdifference.cc │ │ │ ├── setunion.cc │ │ │ ├── sort.cc │ │ │ ├── stablepartition.cc │ │ │ ├── stablesort.cc │ │ │ ├── swap.cc │ │ │ ├── swapranges.cc │ │ │ ├── transform.cc │ │ │ ├── unique.cc │ │ │ ├── uniquecopy.cc │ │ │ └── upperbound.cc │ │ ├── exchange.yo │ │ ├── fill.yo │ │ ├── filln.yo │ │ ├── find.yo │ │ ├── findend.yo │ │ ├── findfirstof.yo │ │ ├── findif.yo │ │ ├── foreach.yo │ │ ├── generate.yo │ │ ├── generaten.yo │ │ ├── heap.yo │ │ ├── heapdemo.yo │ │ ├── includes.yo │ │ ├── innerproduct.yo │ │ ├── inplacemerge.yo │ │ ├── intro.yo │ │ ├── iterswap.yo │ │ ├── lexicographicalcompare.yo │ │ ├── lowerbound.yo │ │ ├── makeheap.yo │ │ ├── max.yo │ │ ├── maxelement.yo │ │ ├── merge.yo │ │ ├── min.yo │ │ ├── minelement.yo │ │ ├── mismatch.yo │ │ ├── nextpermutation.yo │ │ ├── nthelement.yo │ │ ├── partialsort.yo │ │ ├── partialsortcopy.yo │ │ ├── partialsum.yo │ │ ├── partition.yo │ │ ├── popheap.yo │ │ ├── prevpermutation.yo │ │ ├── pushheap.yo │ │ ├── remove.yo │ │ ├── removecopy.yo │ │ ├── removecopyif.yo │ │ ├── removeif.yo │ │ ├── replace.yo │ │ ├── replacecopy.yo │ │ ├── replacecopyif.yo │ │ ├── replaceif.yo │ │ ├── reverse.yo │ │ ├── reversecopy.yo │ │ ├── rotate.yo │ │ ├── rotatecopy.yo │ │ ├── search.yo │ │ ├── searchn.yo │ │ ├── setdifference.yo │ │ ├── setintersection.yo │ │ ├── setsymmetricdifference.yo │ │ ├── setunion.yo │ │ ├── sort.yo │ │ ├── sortheap.yo │ │ ├── stablepartition.yo │ │ ├── stablesort.yo │ │ ├── swap.yo │ │ ├── swapranges.yo │ │ ├── transform.yo │ │ ├── unique.yo │ │ ├── uniquecopy.yo │ │ └── upperbound.yo │ ├── inheritance.yo │ ├── inheritance │ │ ├── accessprom.yo │ │ ├── accessrights.yo │ │ ├── aggregate.yo │ │ ├── assignment.yo │ │ ├── constructor.yo │ │ ├── conversions.yo │ │ ├── depth.yo │ │ ├── derivationtypes.yo │ │ ├── destructor.yo │ │ ├── examples │ │ │ ├── accessprom.cc │ │ │ ├── derivenew.cc │ │ │ ├── nstrings.cc │ │ │ └── placement.cc │ │ ├── intro.yo │ │ ├── move.yo │ │ ├── multiple.yo │ │ ├── nondefault.yo │ │ ├── objectconv.yo │ │ ├── pointerconv.yo │ │ ├── redefining.yo │ │ ├── related.yo │ │ └── usingbase.yo │ ├── intro.yo │ ├── intro │ │ ├── advantage.yo │ │ ├── annohistory.yo │ │ ├── attributes.yo │ │ ├── cascpp.yo │ │ ├── cfunc.yo │ │ ├── compilesources.yo │ │ ├── compiling.yo │ │ ├── cplus.yo │ │ ├── default.yo │ │ ├── differences.yo │ │ ├── eoln.yo │ │ ├── evaluation.yo │ │ ├── examples │ │ │ ├── overload.cc │ │ │ └── switch.cc │ │ ├── header.yo │ │ ├── history.yo │ │ ├── intro.yo │ │ ├── local.yo │ │ ├── main.yo │ │ ├── mswindows.yo │ │ ├── null.yo │ │ ├── object.yo │ │ ├── overload.yo │ │ ├── struct.yo │ │ ├── type.yo │ │ ├── typedef.yo │ │ └── void.yo │ ├── iostreams.yo │ ├── iostreams │ │ ├── cc │ │ │ └── manipulators.cc │ │ ├── conditions.yo │ │ ├── copying.yo │ │ ├── coupling.yo │ │ ├── examples │ │ │ ├── asciiz.cc │ │ │ ├── copycincout.cc │ │ │ ├── copystreambuf.cc │ │ │ ├── cout.OBS │ │ │ ├── coutprintf.cc │ │ │ ├── existingreadwrite.cc │ │ │ ├── hello │ │ │ ├── index │ │ │ ├── ioexceptions.cc │ │ │ ├── isopen.cc │ │ │ ├── istringstream.cc │ │ │ ├── opfstream.OBS │ │ │ ├── ostringstream.cc │ │ │ ├── procbuf.OBS │ │ │ ├── procbufin.OBS │ │ │ ├── procbufout.OBS │ │ │ ├── readdouble.cc │ │ │ ├── readwrite.cc │ │ │ ├── readwrite2.cc │ │ │ ├── redirection.cc │ │ │ ├── stdio.OBS │ │ │ ├── strings │ │ │ └── tiecerrcout.cc │ │ ├── flags.yo │ │ ├── formatmembers.yo │ │ ├── formatting.yo │ │ ├── headers.yo │ │ ├── ifstream.yo │ │ ├── input.yo │ │ ├── intro.yo │ │ ├── ioclasses.fig │ │ ├── ios.yo │ │ ├── iosbase.yo │ │ ├── istream.yo │ │ ├── istreamread.yo │ │ ├── istreamseek.yo │ │ ├── istringstream.yo │ │ ├── moving.yo │ │ ├── ofstream.yo │ │ ├── ostream.yo │ │ ├── ostreamflush.yo │ │ ├── ostreamseek.yo │ │ ├── ostreamwrite.yo │ │ ├── ostringstream.yo │ │ ├── outmodes.yo │ │ ├── output.yo │ │ ├── readwrite.yo │ │ ├── redirection.yo │ │ ├── sbbuffers.eps │ │ └── sbbuffers.fig │ ├── mailus.yo │ ├── memory.yo │ ├── memory │ │ ├── assignment.yo │ │ ├── conclusion.yo │ │ ├── default.yo │ │ ├── deletearray.yo │ │ ├── destructor.yo │ │ ├── elision.yo │ │ ├── enlargearray.yo │ │ ├── examples │ │ │ ├── copycons.cc │ │ │ ├── defaults.cc │ │ │ ├── enlarge.cc │ │ │ ├── fastswap.cc │ │ │ ├── moveassign.cc │ │ │ ├── moveswap.cc │ │ │ ├── moving.cc │ │ │ ├── newhandler.cc │ │ │ ├── placement2.cc │ │ │ ├── strings.cc │ │ │ ├── strings.h │ │ │ ├── strings.ih │ │ │ ├── stringsmove.cc │ │ │ ├── stringstore.cc │ │ │ ├── stringstoredelete.cc │ │ │ ├── stringstoreexample.cc │ │ │ ├── stringstorenodelete.cc │ │ │ └── wrapper.cc │ │ ├── fastswap.yo │ │ ├── initialization.yo │ │ ├── intro.yo │ │ ├── move.yo │ │ ├── moveassignment.yo │ │ ├── movecomposition.yo │ │ ├── movedestructor.yo │ │ ├── moveimplications.yo │ │ ├── moveonly.yo │ │ ├── moving.yo │ │ ├── new.yo │ │ ├── newarray.yo │ │ ├── nocopycons.cc │ │ ├── objectp.yo │ │ ├── operator.yo │ │ ├── overload.yo │ │ ├── placement.yo │ │ ├── pod.yo │ │ ├── raw.yo │ │ ├── revising.yo │ │ ├── revising2.yo │ │ ├── sequential.yo │ │ ├── setnew.yo │ │ ├── swapping.yo │ │ └── this.yo │ ├── namespaces.yo │ ├── namespaces │ │ ├── closed.yo │ │ ├── declaring.yo │ │ ├── defining.yo │ │ ├── directive.yo │ │ ├── examples │ │ │ ├── compound.cc │ │ │ ├── koenig1.cc │ │ │ ├── koenig2.cc │ │ │ ├── koenig3.cc │ │ │ ├── koenig4.cc │ │ │ └── nesting.cc │ │ ├── intro.yo │ │ ├── koenig.yo │ │ ├── nesting.yo │ │ ├── outside.yo │ │ ├── placeholders.yo │ │ ├── referring.yo │ │ └── std.yo │ ├── nested.yo │ ├── nested │ │ ├── declaring.yo │ │ ├── defining.yo │ │ ├── emptyenum.yo │ │ ├── enumerations.yo │ │ ├── examples │ │ │ ├── emptyenum.cc │ │ │ ├── virtcons │ │ │ └── virtcons.cc │ │ ├── nestedfriends.yo │ │ ├── nesting.yo │ │ ├── using.yo │ │ └── virtcons.yo │ ├── overloading.yo │ ├── overloading │ │ ├── argmanipulators.yo │ │ ├── array.yo │ │ ├── binary.yo │ │ ├── conversion.yo │ │ ├── delete.yo │ │ ├── deletearray.yo │ │ ├── examples │ │ │ ├── binary │ │ │ │ ├── CLASSES │ │ │ │ ├── binary │ │ │ │ │ ├── add.cc │ │ │ │ │ ├── binary.h │ │ │ │ │ ├── binary.ih │ │ │ │ │ ├── binary0.cc │ │ │ │ │ ├── binary1.cc │ │ │ │ │ ├── binary2.cc │ │ │ │ │ ├── binary3.cc │ │ │ │ │ ├── data.cc │ │ │ │ │ ├── destructor.cc │ │ │ │ │ ├── operatoradd1.cc │ │ │ │ │ ├── operatoradd2.cc │ │ │ │ │ ├── operatoraddis1.cc │ │ │ │ │ ├── operatoraddis2.cc │ │ │ │ │ ├── operatorassign2.cc │ │ │ │ │ └── swap.cc │ │ │ │ ├── icmconf │ │ │ │ ├── main.cc │ │ │ │ └── main.ih │ │ │ ├── binary1.cc │ │ │ ├── binary1.h │ │ │ ├── binary2.h │ │ │ ├── binary3.h │ │ │ ├── binary4.h │ │ │ ├── binaryadd1.cc │ │ │ ├── binaryambigu.cc │ │ │ ├── binarystring.cc │ │ │ ├── intarray.cc │ │ │ ├── intarray.h │ │ │ ├── intarray.ih │ │ │ ├── manipulator.cc │ │ │ ├── new.cc │ │ │ ├── refbinding1.cc │ │ │ ├── refbinding2.cc │ │ │ ├── refbinding3.cc │ │ │ ├── stringconversionerror.cc │ │ │ ├── vector.h │ │ │ ├── w10.cc │ │ │ └── w10use.cc │ │ ├── explicit.yo │ │ ├── explicitconversion.yo │ │ ├── functionobject.yo │ │ ├── increment.yo │ │ ├── insertextract.yo │ │ ├── iofstreamopen.yo │ │ ├── lambda.yo │ │ ├── lambdasyntax.yo │ │ ├── lambdause.yo │ │ ├── manipulators.yo │ │ ├── more.yo │ │ ├── new.yo │ │ ├── newarray.yo │ │ ├── newdeletearray.yo │ │ ├── newdeleteexceptions.yo │ │ ├── overloadable.yo │ │ ├── reference.yo │ │ ├── sizeddelete.yo │ │ └── userdefined.yo │ ├── overview.yo │ ├── pointermembers.yo │ ├── pointermembers │ │ ├── defining.yo │ │ ├── example.yo │ │ ├── examples │ │ │ ├── casestring.OBS │ │ │ ├── casestring.h.OBS │ │ │ ├── initializing.cc │ │ │ ├── pointerdata.cc │ │ │ ├── pointermembers.cc │ │ │ ├── size.cc │ │ │ ├── union.cc │ │ │ └── using.cc │ │ ├── extra.1 │ │ ├── fig │ │ │ └── personfig.fig │ │ ├── implement.yo │ │ ├── intro.yo │ │ ├── sizes.yo │ │ ├── static.yo │ │ └── using.yo │ ├── polymorphism.yo │ ├── polymorphism │ │ ├── ambiguity.yo │ │ ├── base.yo │ │ ├── constructors.yo │ │ ├── derivingfromstreambuf.yo │ │ ├── destructor.yo │ │ ├── dynamiccast.yo │ │ ├── errorcategory.yo │ │ ├── examples │ │ │ ├── badcast.cc │ │ │ ├── emptythrow.cc │ │ │ ├── exception.h │ │ │ ├── fatal.h │ │ │ ├── message.h │ │ │ ├── notvirtual.cc │ │ │ ├── purevirtualimp.cc │ │ │ ├── virtcons.cc │ │ │ ├── virtcons2.cc │ │ │ ├── virtcons3.cc │ │ │ ├── virtconsorg.cc │ │ │ ├── virtualinherit.cc │ │ │ ├── vtable.cc │ │ │ └── warning.h │ │ ├── exception.yo │ │ ├── explicit.yo │ │ ├── filebuf.yo │ │ ├── function.yo │ │ ├── implementation.yo │ │ ├── implementing.yo │ │ ├── inheritance.yo │ │ ├── init.yo │ │ ├── intro.yo │ │ ├── multiple.yo │ │ ├── notvirtual.yo │ │ ├── protectedbuffer.yo │ │ ├── protectedinput.yo │ │ ├── protectedoutput.yo │ │ ├── protectedstreambuf.yo │ │ ├── pure.yo │ │ ├── rtti.yo │ │ ├── streambufdef.yo │ │ ├── typeid.yo │ │ └── undefined.yo │ ├── preamble.yo │ ├── static.yo │ ├── static │ │ ├── calling.yo │ │ ├── const.yo │ │ ├── constexprdata.yo │ │ ├── data.yo │ │ ├── function.yo │ │ ├── genconst.yo │ │ ├── intro.yo │ │ ├── private.yo │ │ └── public.yo │ ├── stl.yo │ ├── stl │ │ ├── arithmetic.yo │ │ ├── bernoulli.yo │ │ ├── binomial.yo │ │ ├── cauchy.yo │ │ ├── charclass.yo │ │ ├── chisquared.yo │ │ ├── classeshavingpointers.yo │ │ ├── defining.yo │ │ ├── definingshared.yo │ │ ├── distance.yo │ │ ├── examples │ │ │ ├── adaptors.cc │ │ │ ├── adaptors2.cc.OBS │ │ │ ├── back_inserter.OBS │ │ │ ├── backinserter.cc │ │ │ ├── bind.cc │ │ │ ├── chrono.cc │ │ │ ├── classtypeplus.cc │ │ │ ├── constiterator.cc │ │ │ ├── copy.OBS │ │ │ ├── copyFromIstream.OBS │ │ │ ├── deleter.cc │ │ │ ├── deletertemplate.cc │ │ │ ├── format.cc │ │ │ ├── geometric.cc │ │ │ ├── insertcpp.cc │ │ │ ├── istreamiterator.cc │ │ │ ├── iterator.cc │ │ │ ├── makeshared.cc.OBS │ │ │ ├── mathdists.OBS │ │ │ ├── move.cc.OBS │ │ │ ├── negate.cc │ │ │ ├── normal.cc │ │ │ ├── not.cc │ │ │ ├── oformstream.cc │ │ │ ├── oformstream.h │ │ │ ├── ostreamiterator.cc │ │ │ ├── plus.cc │ │ │ ├── plusaccumulate.cc │ │ │ ├── regex.cc │ │ │ ├── regexplain.cc │ │ │ ├── regexreplace.cc │ │ │ ├── regexreplace2.cc │ │ │ ├── regexsearch.cc │ │ │ ├── sharedarray.cc │ │ │ ├── sharedinsert.cc │ │ │ ├── sharedptr.cc │ │ │ ├── sort.cc │ │ │ ├── strcasecmp.cc │ │ │ ├── streambufiter.cc │ │ │ ├── uniqueother.cc │ │ │ └── uniqueptr.cc │ │ ├── exponential.yo │ │ ├── extremevalue.yo │ │ ├── fig │ │ │ └── heap │ │ ├── filesystem │ │ │ ├── directoryentry.yo │ │ │ ├── directoryiterator.yo │ │ │ ├── examples │ │ │ │ ├── absolute.cc │ │ │ │ ├── directoryentry.cc │ │ │ │ ├── filesystemerror.cc │ │ │ │ ├── path.cc │ │ │ │ ├── spaceinfo.cc │ │ │ │ └── statusknown.cc │ │ │ ├── filestatus.yo │ │ │ ├── filesystemerror.yo │ │ │ ├── functions.yo │ │ │ ├── intro.yo │ │ │ ├── path.yo │ │ │ └── spaceinfo.yo │ │ ├── fisherf.yo │ │ ├── format.yo │ │ ├── gamma.yo │ │ ├── geometric.yo │ │ ├── insertiterators.yo │ │ ├── intro.yo │ │ ├── istreambufiterators.yo │ │ ├── istreamiterators.yo │ │ ├── iterators.yo │ │ ├── logical.yo │ │ ├── lognormal.yo │ │ ├── makeshared.yo │ │ ├── matchflags.yo │ │ ├── negativebinomial.yo │ │ ├── normal.yo │ │ ├── notfn.yo │ │ ├── ostreambufiterators.yo │ │ ├── ostreamiterators.yo │ │ ├── poisson.yo │ │ ├── predefined.yo │ │ ├── randomnumber.yo │ │ ├── regalg.yo │ │ ├── regex.yo │ │ ├── regexlanguage.yo │ │ ├── regexmatch.yo │ │ ├── regexreplace.yo │ │ ├── regexsearch.yo │ │ ├── regularexp.yo │ │ ├── relational.yo │ │ ├── sharedarrays.yo │ │ ├── sharedcasts.yo │ │ ├── sharedmembers.yo │ │ ├── sharednew.yo │ │ ├── sharedplain.yo │ │ ├── sharedptr.yo │ │ ├── smatch.yo │ │ ├── statdist.yo │ │ ├── statistical.yo │ │ ├── studentt.yo │ │ ├── uniformint.yo │ │ ├── uniformreal.yo │ │ ├── uniquearrays.yo │ │ ├── uniquemembers.yo │ │ ├── uniquemove.yo │ │ ├── uniquenew.yo │ │ ├── uniqueplain.yo │ │ ├── uniqueptr.yo │ │ └── weibull.yo │ ├── string.yo │ ├── string │ │ ├── convertors.yo │ │ ├── examples │ │ │ ├── stringappend.cc │ │ │ ├── stringassign.cc │ │ │ ├── stringcompare.cc │ │ │ ├── stringcompare2.cc │ │ │ ├── stringcstr.cc │ │ │ ├── stringdata.cc │ │ │ ├── stringempty.cc │ │ │ ├── stringerase.cc │ │ │ ├── stringfindfirst.cc │ │ │ ├── stringinsert.cc │ │ │ ├── stringreplace.cc │ │ │ ├── stringsize.cc │ │ │ ├── stringsubscript.cc │ │ │ ├── stringsubstr.cc │ │ │ └── stringswap.cc │ │ ├── initializers.yo │ │ ├── iterators.yo │ │ ├── members.yo │ │ ├── operators.yo │ │ ├── ops.yo │ │ ├── overview.yo │ │ └── string.yo │ ├── threading.yo │ ├── threading │ │ ├── async.yo │ │ ├── atomic.yo │ │ ├── clock.yo │ │ ├── compilations.yo │ │ ├── conditionany.yo │ │ ├── conditionex.yo │ │ ├── conditionvar.yo │ │ ├── deadlocks.yo │ │ ├── duration.yo │ │ ├── events.yo │ │ ├── examples │ │ │ ├── alreadyretrieved.cc │ │ │ ├── anonymous.cc │ │ │ ├── async1.cc │ │ │ ├── async2.cc │ │ │ ├── async3.cc │ │ │ ├── async4.cc │ │ │ ├── asynccall.cc │ │ │ ├── brokenpromise.cc │ │ │ ├── callonce.cc │ │ │ ├── clock.cc │ │ │ ├── cmdfork │ │ │ │ ├── childprocess.cc │ │ │ │ ├── childredirections.cc │ │ │ │ ├── cmdfork.h │ │ │ │ ├── cmdfork.ih │ │ │ │ ├── cmdfork1.cc │ │ │ │ ├── icmconf │ │ │ │ └── parentprocess.cc │ │ │ ├── coutguard.cc │ │ │ ├── deadlock.cc │ │ │ ├── detached.cc │ │ │ ├── detached1.cc │ │ │ ├── events.cc │ │ │ ├── exceptionptr.cc │ │ │ ├── functorthread.cc │ │ │ ├── hello.cc │ │ │ ├── hwconcurrency.cc │ │ │ ├── insertguard.cc │ │ │ ├── joinguard.cc │ │ │ ├── joinguard.h │ │ │ ├── locals.cc │ │ │ ├── lock.cc │ │ │ ├── multicmdfork │ │ │ │ ├── data.cc │ │ │ │ ├── dispatch.cc │ │ │ │ ├── files.in │ │ │ │ ├── files.sh │ │ │ │ ├── icmconf │ │ │ │ ├── main.cc │ │ │ │ ├── main.ih │ │ │ │ └── process.cc │ │ │ ├── multicompile │ │ │ │ ├── compile.cc │ │ │ │ ├── data.cc │ │ │ │ ├── dispatch.cc │ │ │ │ ├── files.in │ │ │ │ ├── files.sh │ │ │ │ ├── icmconf │ │ │ │ ├── jobs.cc │ │ │ │ ├── main.cc │ │ │ │ ├── main.ih │ │ │ │ ├── main2.ih │ │ │ │ ├── newresult.cc │ │ │ │ ├── newtask.cc │ │ │ │ ├── pushresultq.cc │ │ │ │ ├── results.cc │ │ │ │ ├── worker.cc │ │ │ │ └── workforce.cc │ │ │ ├── multisort │ │ │ │ ├── condition.h │ │ │ │ ├── data.cc │ │ │ │ ├── display.cc │ │ │ │ ├── icmconf │ │ │ │ ├── main.cc │ │ │ │ ├── main.ih │ │ │ │ ├── newtask.cc │ │ │ │ ├── partition.cc │ │ │ │ ├── pushtask.cc │ │ │ │ ├── readdata.cc │ │ │ │ ├── scheduler.cc │ │ │ │ ├── wip.cc │ │ │ │ ├── worker.cc │ │ │ │ └── workforce.cc │ │ │ ├── nostate.cc │ │ │ ├── onceflag.cc │ │ │ ├── packagedtask.cc │ │ │ ├── packagedtask.in │ │ │ ├── promise0.cc │ │ │ ├── promise1.cc │ │ │ ├── promise2.cc │ │ │ ├── promisealreadysatisfied.cc │ │ │ ├── promisealreadysatisfied2.cc │ │ │ ├── qsort.cc │ │ │ ├── race.cc │ │ │ ├── random.cc │ │ │ ├── semaphore │ │ │ │ ├── icmconf │ │ │ │ ├── increase.cc │ │ │ │ ├── reduce.cc │ │ │ │ ├── semaphore.h │ │ │ │ ├── semaphore.ih │ │ │ │ ├── semaphore1.cc │ │ │ │ └── size.cc │ │ │ ├── sharedfuture.cc │ │ │ ├── simple.cc │ │ │ ├── sleepuntil.cc │ │ │ ├── staticlocal.cc │ │ │ ├── terminate.cc │ │ │ ├── threadaction.cc │ │ │ ├── threadargs.cc │ │ │ ├── threadlocal.cc │ │ │ ├── threads2.cc │ │ │ ├── throwing.cc │ │ │ └── timepoint.cc │ │ ├── exceptionptr.yo │ │ ├── future.yo │ │ ├── futureerrc.yo │ │ ├── initialization.yo │ │ ├── intro.yo │ │ ├── joining.yo │ │ ├── locks.yo │ │ ├── mutex.yo │ │ ├── ntbs.yo │ │ ├── packagedtask.yo │ │ ├── promise.yo │ │ ├── puttimefmt.yo │ │ ├── quicksort.yo │ │ ├── ratio.yo │ │ ├── shared.yo │ │ ├── sharedfuture.yo │ │ ├── sharedlock.yo │ │ ├── sharedmutex.yo │ │ ├── thisthread.yo │ │ ├── thread.yo │ │ ├── threading.yo │ │ ├── threadlocal.yo │ │ ├── time.yo │ │ ├── timepoint.yo │ │ └── wip │ ├── verbinsert.cc │ ├── version.yo │ ├── whatsnew.yo │ └── whatsnew.yo.old └── zip │ ├── collect │ ├── eps.zip │ ├── gif.zip │ ├── install │ ├── prepare │ └── svg.zip ├── cppannotations └── html │ └── exceptions │ └── systemerror.gif ├── excluded └── sourcetar /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | The C++ Annotations offer an extensive tutorial about the C++ programming 2 | language. It can be used as a textbook for C/C++ programming courses. 3 | 4 | The C++ Annotation's repository has moved to https://gitlab.com/fbb-git/cppannotations 5 | and is not maintained at this location anymore. 6 | 7 | The project's web-page can be found at http://fbb-git.gitlab.io/cppannotations/ 8 | -------------------------------------------------------------------------------- /annotations/README: -------------------------------------------------------------------------------- 1 | The cplusplus.latex.zip, cplusplus.ps.zip and cplusplus.pdf.zip archives 2 | contain both cplusplus.* and cplusplusus.* files. 3 | 4 | The cplusplus.* files were created with the (European) A4 paper size in mind: 5 | the related PostScript and PDF files should be printable without problems on 6 | A4 sized paper. 7 | 8 | The cplusplusus.* files were created with the (U.S.) Letter paper size in 9 | mind: the related PostScript and PDF files should be printable without 10 | problems on US_Letter sized paper. 11 | 12 | Vector graphics were created by the 'inkscape' program -------------------------------------------------------------------------------- /annotations/README.newchapter: -------------------------------------------------------------------------------- 1 | When a new chapter is added, adapt single/target.shtml accordingly 2 | 3 | -------------------------------------------------------------------------------- /annotations/TODO: -------------------------------------------------------------------------------- 1 | Structured binding declarations (cf https://en.wikipedia.org/wiki/C++17 en 2 | ~/downloads/n4659.pdf 3 | 4 | Add weak_ptr 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /annotations/VERSION: -------------------------------------------------------------------------------- 1 | #define VERSION "10.9.2" 2 | #define YEARS "1994-2018" 3 | -------------------------------------------------------------------------------- /annotations/bin/createall: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CWD=`pwd` 4 | 5 | if [ `basename $CWD` != "bin" ] 6 | then 7 | echo $0 must be called from the bin subdirectory 8 | exit 1 9 | fi 10 | 11 | (allcreate.aux $0 $* 2>&1) | /usr/bin/tee ../script.log 12 | -------------------------------------------------------------------------------- /annotations/bin/createlatex: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../yo 4 | 5 | echo 1>&2 " 6 | Construct .latex file from `pwd`. 7 | Converting .yo to .latex 8 | " 9 | 10 | PATH=`pwd`/tmp/bin:$PATH 11 | yodl2latex --no-warnings -l3 cplusplus 12 | 13 | [ $? -eq 0 ] || exit 1 14 | 15 | echo 1>&2 " 16 | Moving .latex file to ../latex 17 | " 18 | 19 | mv cplusplus.latex ../latex/cplusplus.latex 20 | 21 | ../bin/latexonly 22 | -------------------------------------------------------------------------------- /annotations/bin/createlatexus: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../yo 4 | 5 | echo 1>&2 " 6 | Construct .latex file from `pwd`. 7 | Converting .yo to .latex 8 | " 9 | 10 | PATH=`pwd`/tmp/bin:$PATH 11 | yodl2latex --no-warnings -l3 --define=us cplusplus 12 | 13 | [ $? -eq 0 ] || exit 1 14 | 15 | echo 1>&2 " 16 | Moving .latex file to ../latex 17 | " 18 | 19 | mv cplusplus.latex ../latex/cplusplusus.latex 20 | 21 | ../bin/latexonly us 22 | -------------------------------------------------------------------------------- /annotations/bin/createpdf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../latex 4 | 5 | echo -n Converting ps to pdf ... 6 | ps2pdf cplusplus.ps 7 | 8 | if [ -e cplusplusus.ps ] 9 | then 10 | echo -n ", converting letter sized ps to pdf ..." 11 | ps2pdf cplusplusus.ps 12 | fi 13 | 14 | echo done 15 | -------------------------------------------------------------------------------- /annotations/bin/createpostscript: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../latex 4 | 5 | dvips -ocplusplus.ps cplusplus 6 | 7 | [ -e cplusplusus.dvi ] && dvips -o cplusplusus.ps cplusplusus 8 | 9 | # end 10 | -------------------------------------------------------------------------------- /annotations/bin/createtxt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../yo 4 | 5 | PATH=`pwd`/tmp/bin:$PATH 6 | yodl2txt --no-warnings -l3 cplusplus 7 | 8 | if [ $? != 0 ] ; then 9 | echo text conversion failed 10 | exit 1 11 | fi 12 | 13 | mv cplusplus.txt ../zip 14 | -------------------------------------------------------------------------------- /annotations/bin/detab: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../yo 4 | 5 | FILES=`find ./ -name '*.cc' -o -name '*.h' -o -name '*.ih' -o -name '*.yo'` 6 | echo detabbing... 7 | tab $FILES 8 | echo trimming... 9 | trim -q $FILES 10 | 11 | 12 | -------------------------------------------------------------------------------- /annotations/bin/htmlindex: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../html 4 | # Construct index page in /html dir. 5 | 6 | grep '^ cplusplus.index 7 | 8 | ../tmp/bin/htmlindex < cplusplus.index > cppindex.html 9 | -------------------------------------------------------------------------------- /annotations/bin/imagemove: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../yo 4 | 5 | GIFS=`find ./ -name '*.gif'` 6 | 7 | if [ "$GIFS" == "" ] ; then 8 | echo no gifs 9 | else 10 | tar cf - $GIFS | (cd ../html; tar xvf -) 11 | rm $GIFS 12 | fi 13 | 14 | 15 | PS=`find ./ -name '*.eps'` 16 | 17 | if [ "$PS" == "" ] ; then 18 | echo no ps files 19 | else 20 | tar cf - $PS | (cd ../latex; tar xvf -) 21 | rm $PS 22 | fi 23 | 24 | -------------------------------------------------------------------------------- /annotations/bin/latexarchive: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../yo 4 | 5 | yodl2latex cplusplus 6 | 7 | if [ $? != 0 ] ; then 8 | echo latex conversion failed 9 | exit 1 10 | fi 11 | 12 | mv cplusplus.latex ../latex 13 | 14 | -------------------------------------------------------------------------------- /annotations/bin/parentheses: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../yo 4 | 5 | paren `find ./ -name '*.yo'` 6 | 7 | -------------------------------------------------------------------------------- /annotations/bin/patchhtmlindexentries: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../html 4 | 5 | for x in `ls cplusplus[0-9][0-9].html` ; do 6 | ../tmp/bin/rmindexlines < $x > ${x}2 7 | mv ${x}2 $x 8 | done 9 | -------------------------------------------------------------------------------- /annotations/bin/patchhtmlpre: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../html 4 | 5 | for x in `ls cplusplus.html cplusplus[0-9][0-9].html` ; do 6 | ../bin/patchhtml < $x > ${x}2 7 | mv ${x}2 $x 8 | done 9 | -------------------------------------------------------------------------------- /annotations/bin/patchlatexidx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd ../latex 4 | sed ' 5 | s/"/\\"/g 6 | s/!/\\!/g 7 | s//\$>\$/g 9 | ' cplusplus${1}.ind > cplusplus.ind.out 10 | 11 | mv cplusplus.ind.out cplusplus${1}.ind 12 | -------------------------------------------------------------------------------- /annotations/bin/ziphtml: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd `dirname $0` 4 | CPPDIR=`cd ..;pwd` 5 | CPP=`basename $CPPDIR` 6 | cd `dirname $CPPDIR` 7 | 8 | cp $CPP/single/* $CPP/html 9 | 10 | rm -f $CPP/zip/cplusplus.html.zip 11 | zip -ry $CPP/zip/cplusplus.html.zip $CPP/html/* $CPP/changelog -x *.svn* 12 | 13 | ln -sf ../contrib $CPP/html 14 | zip -r $CPP/zip/cplusplus.html.zip $CPP/html/contrib -x *.svn* 15 | rm $CPP/html/contrib 16 | 17 | # end 18 | 19 | -------------------------------------------------------------------------------- /annotations/bin/ziptxt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd `dirname $0` 4 | CPPDIR=`cd ..;pwd` 5 | CPP=`basename $CPPDIR` 6 | cd `dirname $CPPDIR` 7 | 8 | cp $CPP/single/legal.shtml $CPP/zip 9 | 10 | if [ -s $CPP/zip/cplusplus.txt ] ; then 11 | rm -f $CPP/zip/cplusplus.txt.zip 12 | zip -m $CPP/zip/cplusplus.txt.zip $CPP/zip/cplusplus.txt\ 13 | $CPP/zip/legal.shtml 14 | 15 | zip $CPP/zip/cplusplus.txt.zip $CPP/changelog 16 | zip -r $CPP/zip/cplusplus.txt.zip $CPP/contrib -x *.svn* 17 | fi 18 | -------------------------------------------------------------------------------- /annotations/bin/zipyo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd `dirname $0` 4 | CPPDIR=`cd ..;pwd` 5 | CPP=`basename $CPPDIR` 6 | cd `dirname $CPPDIR` 7 | 8 | cp $CPP/single/legal.shtml $CPP/yo 9 | 10 | rm -f $CPP/zip/cplusplus.yo.zip 11 | zip -ry $CPP/zip/cplusplus.yo.zip $CPP/changelog $CPP/yo/* -x *.svn* 12 | 13 | ln -sf ../contrib $CPP/yo 14 | zip -r $CPP/zip/cplusplus.yo.zip $CPP/yo/contrib -x *.svn* 15 | rm $CPP/yo/contrib 16 | 17 | # end 18 | 19 | -------------------------------------------------------------------------------- /annotations/contributions/chist.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/contributions/chist.pdf -------------------------------------------------------------------------------- /annotations/contributions/cplusplus.pt_BR.odt.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/contributions/cplusplus.pt_BR.odt.zip -------------------------------------------------------------------------------- /annotations/contributions/cplusplus.pt_BR.pdf.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/contributions/cplusplus.pt_BR.pdf.zip -------------------------------------------------------------------------------- /annotations/contributions/makebook.sh.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/contributions/makebook.sh.gz -------------------------------------------------------------------------------- /annotations/html/advancedtemplates/multibase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/advancedtemplates/multibase.gif -------------------------------------------------------------------------------- /annotations/html/annotations.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/annotations.gif -------------------------------------------------------------------------------- /annotations/html/classtemplates/converting.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/classtemplates/converting.gif -------------------------------------------------------------------------------- /annotations/html/classtemplates/notfn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/classtemplates/notfn.gif -------------------------------------------------------------------------------- /annotations/html/containers/dellist.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/containers/dellist.gif -------------------------------------------------------------------------------- /annotations/html/containers/insertlist.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/containers/insertlist.gif -------------------------------------------------------------------------------- /annotations/html/containers/list.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/containers/list.gif -------------------------------------------------------------------------------- /annotations/html/containers/queue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/containers/queue.gif -------------------------------------------------------------------------------- /annotations/html/containers/stack/stack.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/containers/stack/stack.gif -------------------------------------------------------------------------------- /annotations/html/exceptions/systemerror.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/exceptions/systemerror.gif -------------------------------------------------------------------------------- /annotations/html/first/datahiding.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/first/datahiding.gif -------------------------------------------------------------------------------- /annotations/html/functiontemplates/selection.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/functiontemplates/selection.gif -------------------------------------------------------------------------------- /annotations/html/inheritance/hierarchy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/inheritance/hierarchy.gif -------------------------------------------------------------------------------- /annotations/html/intro/objects.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/intro/objects.gif -------------------------------------------------------------------------------- /annotations/html/iostreams/ioclasses.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/iostreams/ioclasses.gif -------------------------------------------------------------------------------- /annotations/html/iostreams/sbbuffers.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/iostreams/sbbuffers.gif -------------------------------------------------------------------------------- /annotations/html/memory/badassign.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/memory/badassign.gif -------------------------------------------------------------------------------- /annotations/html/memory/fswap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/memory/fswap.gif -------------------------------------------------------------------------------- /annotations/html/memory/fswap2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/memory/fswap2.gif -------------------------------------------------------------------------------- /annotations/html/memory/rightass.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/memory/rightass.gif -------------------------------------------------------------------------------- /annotations/html/modaye: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /annotations/html/pointermembers/personfig.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/pointermembers/personfig.gif -------------------------------------------------------------------------------- /annotations/html/pointermembers/sizes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/pointermembers/sizes.gif -------------------------------------------------------------------------------- /annotations/html/polymorphism/ambiguity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/polymorphism/ambiguity.gif -------------------------------------------------------------------------------- /annotations/html/polymorphism/caumon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/polymorphism/caumon.gif -------------------------------------------------------------------------------- /annotations/html/polymorphism/implementation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/polymorphism/implementation.gif -------------------------------------------------------------------------------- /annotations/html/polymorphism/internal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/polymorphism/internal.gif -------------------------------------------------------------------------------- /annotations/html/polymorphism/multivtable.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/polymorphism/multivtable.gif -------------------------------------------------------------------------------- /annotations/html/polymorphism/virtbase.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/polymorphism/virtbase.gif -------------------------------------------------------------------------------- /annotations/html/sigfrank.shtml: -------------------------------------------------------------------------------- 1 |

2 | 3 | Frank B. Brokken 4 | (f.b.brokken@rug.nl)
5 | 6 | 7 | 8 |
9 |

10 | -------------------------------------------------------------------------------- /annotations/html/stl/heap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/stl/heap.gif -------------------------------------------------------------------------------- /annotations/html/threading/compile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/threading/compile.gif -------------------------------------------------------------------------------- /annotations/html/threading/sorting.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/threading/sorting.gif -------------------------------------------------------------------------------- /annotations/html/threading/time.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/html/threading/time.gif -------------------------------------------------------------------------------- /annotations/icmake/backtick: -------------------------------------------------------------------------------- 1 | list backtick(string arg) 2 | { 3 | list ret; 4 | 5 | echo(OFF); 6 | ret = `arg`; 7 | echo(g_echo); 8 | return ret; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /annotations/icmake/clean: -------------------------------------------------------------------------------- 1 | string remove1; 2 | string remove2; 3 | 4 | void setRemovals() 5 | { 6 | remove1 = "tmp ../sf/index.html ../sf/cppannotations"; 7 | remove2 = "o indexentry/o aux/o"; 8 | } 9 | 10 | void clean(int stop) 11 | { 12 | setRemovals(); 13 | 14 | run("rm -rf " + remove1); 15 | 16 | chdir("src/htmlindex"); 17 | run("rm -rf " + remove2); 18 | 19 | if (stop) 20 | exit(0); 21 | else 22 | chdir("../../"); 23 | } 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /annotations/icmake/cuteoln: -------------------------------------------------------------------------------- 1 | string cutEoln(string text) 2 | { 3 | int len; 4 | 5 | len = strlen(text) - 1; 6 | if (text[len] == "\n") 7 | text = substr(text, 0, len); 8 | return text; 9 | } 10 | -------------------------------------------------------------------------------- /annotations/icmake/github: -------------------------------------------------------------------------------- 1 | void github() 2 | { 3 | run("cp -r yo/version.yo tmp/manhtml/c++-annotations-man.html " 4 | "tmp/docs/zips ../../wip"); 5 | run("cp changelog ../../wip/changelog.txt"); 6 | exit(0); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/icmake/latex: -------------------------------------------------------------------------------- 1 | void latex() 2 | { 3 | md("tmp/docs/latex"); 4 | 5 | system("rm -f tmp/cplusplus*-stamp tmp/_cplusplus*-stamp tmp/dvi*-stamp " 6 | "tmp/docs/latex/cplusplus*"); 7 | 8 | latexdoc("", 0); 9 | latexdoc("us", 0); 10 | 11 | printf("the log files are in tmp/docs/latex\n"); 12 | 13 | exit(0); 14 | } 15 | -------------------------------------------------------------------------------- /annotations/icmake/log: -------------------------------------------------------------------------------- 1 | void log(string file) 2 | { 3 | g_log += (list)(g_logMark + " file " + md5sum(file) + " " + file); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /annotations/icmake/loglink: -------------------------------------------------------------------------------- 1 | void logLink(string file) 2 | { 3 | g_log += (list)(g_logMark + " link " + file); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /annotations/icmake/man: -------------------------------------------------------------------------------- 1 | void man() 2 | { 3 | md("tmp/man tmp/manhtml"); 4 | 5 | if ("man/c++-annotations.yo" younger "tmp/man/c++-annotations.7") 6 | { 7 | chdir("man"); 8 | system("yodl2man -o ../tmp/man/c++-annotations.7 c++-annotations"); 9 | system("yodl2html -o ../tmp/manhtml/c++-annotations-man.html " 10 | "c++-annotations"); 11 | chdir(g_cwd); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /annotations/icmake/mark: -------------------------------------------------------------------------------- 1 | void mark() 2 | { 3 | g_logMark = backtick("printf '%3d' " + (string)g_lognr++)[0]; 4 | } 5 | -------------------------------------------------------------------------------- /annotations/icmake/md5sum: -------------------------------------------------------------------------------- 1 | string md5sum(string file) 2 | { 3 | return substr(strtok(backtick("md5sum " + file)[0], " \t")[0], 0, 5); 4 | } 5 | 6 | -------------------------------------------------------------------------------- /annotations/icmake/pre: -------------------------------------------------------------------------------- 1 | void pre() 2 | { 3 | string files; 4 | 5 | programs(0); 6 | 7 | files = stringlist("", "yo", "*.yo"); 8 | 9 | cleanup("paren", files); 10 | 11 | files = stringlist("", "yo", "*.cc") + 12 | stringlist("", "yo", "*.h") + 13 | stringlist("", "yo", "*.ih"); 14 | 15 | cleanup("tab", files); 16 | cleanup("trim", files); 17 | 18 | exit(0); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /annotations/icmake/readlog: -------------------------------------------------------------------------------- 1 | void readlog() 2 | { 3 | list line; 4 | 5 | while (line = fgets(g_logPath, line)) 6 | g_log += strtok(line[0], "\n"); // add logfile entries w/o \n 7 | } 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /annotations/icmake/remove: -------------------------------------------------------------------------------- 1 | void remove(list entry) 2 | { 3 | int equal; 4 | string file; 5 | 6 | file = entry[3]; 7 | 8 | if (!exists(file)) 9 | return; 10 | 11 | equal = md5sum(file) == entry[2]; 12 | 13 | if (equal) 14 | run("rm " + file); 15 | else 16 | printf("not removing modified file ", file, "\n"); 17 | } 18 | -------------------------------------------------------------------------------- /annotations/icmake/run: -------------------------------------------------------------------------------- 1 | void run(string cmd) 2 | { 3 | if (g_echo == OFF) 4 | cmd += "> /dev/null 2>&1"; 5 | 6 | system(0, cmd); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /annotations/icmake/verify: -------------------------------------------------------------------------------- 1 | void verifyrun(string file) 2 | { 3 | printf("\n" 4 | "checking tmp/docs/latex/" + file + ":\n"); 5 | 6 | system(P_NOCHECK, 7 | "grep -i \"overfull\\|undefined\" " + file + " | " 8 | "fgrep -v polymorphism/undefined"); 9 | } 10 | 11 | void verify() 12 | { 13 | chdir("tmp/docs/latex"); 14 | 15 | verifyrun("cplusplus.log"); 16 | verifyrun("cplusplusus.log"); 17 | 18 | exit(0); 19 | } 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /annotations/icmake/writelog: -------------------------------------------------------------------------------- 1 | void writeLog() 2 | { 3 | int idx; 4 | 5 | if (g_logPath != "") // do not store uninstall info 6 | { 7 | for (idx = listlen(g_log); idx--; ) 8 | fprintf(g_logPath, g_log[idx], "\n"); 9 | } 10 | 11 | exit(0); 12 | } 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /annotations/pathbuild: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PATH=`pwd`/tmp/bin:$PATH 4 | exec ./abuild $* 5 | -------------------------------------------------------------------------------- /annotations/pattern: -------------------------------------------------------------------------------- 1 | ([^:]+): 2 | -------------------------------------------------------------------------------- /annotations/required: -------------------------------------------------------------------------------- 1 | This file lists non-standard software only. Thus, standard utilities like cp, 2 | mv, sed, etc, etc, are not explicitly mentioned. Neither are the gcc and g++ 3 | compilers explicitly mentioned, but fairly recent ones are assumed. 4 | 5 | Required software for building the C++ Annotations: 6 | --------------------------------------------------- 7 | 8 | icmake (>= 9.02.04), yodl (>= 4.02.00), libbobcat-dev (>= 4.08.02), flex, zip, 9 | texlive-latex-base, texlive-generic-recommended, texlive-latex-recommended, 10 | texlive-fonts-recommended, ghostscript 11 | 12 | 13 | -------------------------------------------------------------------------------- /annotations/scripts/patchlatexidx: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # not used anymore. previously called from ~/icmake/docs 4 | 5 | # sed ' 6 | # s/"/\\"/g 7 | # s/!/$!$/g 8 | # s//\$>\$/g 10 | # ' cplusplus${1}.ind > cplusplus.ind.out 11 | # 12 | # mv cplusplus.ind.out cplusplus${1}.ind 13 | -------------------------------------------------------------------------------- /annotations/src/htmlindex/aux/head.cc: -------------------------------------------------------------------------------- 1 | #include "../htmlindex.h" 2 | 3 | void head() 4 | { 5 | 6 | cout << "\n" 7 | "\n" 8 | "C++ Annotations HTML Index \n" 9 | "\n" 10 | "\n" 11 | "\n" 12 | "\n" 13 | "

Index

\n" 14 | "\n" 15 | "\n" 16 | "\n"; 17 | } 18 | -------------------------------------------------------------------------------- /annotations/src/htmlindex/aux/tail.cc: -------------------------------------------------------------------------------- 1 | #include "../htmlindex.h" 2 | 3 | void tail() 4 | { 5 | 6 | cout << "\n" 7 | "\n" 8 | "
\n" 9 | "\n"; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/src/htmlindex/indexentry/indexentry.cc: -------------------------------------------------------------------------------- 1 | #include "../htmlindex.h" 2 | 3 | IndexEntry::IndexEntry(string const &keystring, 4 | unsigned filenameIndex, unsigned labelNr) 5 | : 6 | key(keystring) 7 | { 8 | for (string::iterator it = key.begin(); it != key.end(); it++) 9 | if (*it != ' ') 10 | uppercaseKey += toupper(*it); 11 | 12 | labels.push_back(pair(filenameIndex, labelNr)); 13 | } 14 | -------------------------------------------------------------------------------- /annotations/src/htmlindex/indexentry/indexentry.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/src/htmlindex/indexentry/indexentry.h -------------------------------------------------------------------------------- /annotations/src/htmlindex/indexentry/operatorless.cc: -------------------------------------------------------------------------------- 1 | #include "../htmlindex.h" 2 | 3 | bool IndexEntry::operator<(IndexEntry const &other) const 4 | { 5 | if (isalnum(uppercaseKey[0]) && !isalnum(other.uppercaseKey[0])) 6 | return false; // alphanumeric entries after special chars 7 | 8 | if (!isalnum(uppercaseKey[0]) && isalnum(other.uppercaseKey[0])) 9 | return true; // special chars before alphanumeric entries 10 | 11 | return uppercaseKey < other.uppercaseKey; 12 | } 13 | -------------------------------------------------------------------------------- /annotations/src/htmlindex/indexentry/showrefs.cc: -------------------------------------------------------------------------------- 1 | #include "../htmlindex.h" 2 | 3 | void IndexEntry::showRefs() 4 | { 5 | for 6 | ( 7 | vector >::iterator it = labels.begin(); 8 | it != labels.end(); 9 | it++ 10 | ) 11 | cout << " second << " target=info>" << 13 | it->second << " \n"; 14 | } 15 | -------------------------------------------------------------------------------- /annotations/src/htmlindex/version.cc: -------------------------------------------------------------------------------- 1 | #include "htmlindex.h" 2 | 3 | char 4 | version[] = "1.13", 5 | year[] = "2001-2014"; 6 | -------------------------------------------------------------------------------- /annotations/src/tab/fname.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef MSDOS 4 | #define SEP '\\' 5 | #else 6 | #define SEP '/' 7 | #endif 8 | 9 | char *fname(char *prog) 10 | { 11 | register char 12 | *cp; 13 | 14 | if ( (cp = strrchr(prog, SEP)) ) 15 | cp++; 16 | else 17 | cp = prog; 18 | 19 | # ifdef MSDOS 20 | *strstr (cp, ".EXE") = '\0'; 21 | # endif 22 | 23 | return (cp); 24 | } 25 | -------------------------------------------------------------------------------- /annotations/src/tabs/CLASSES: -------------------------------------------------------------------------------- 1 | tabber 2 | -------------------------------------------------------------------------------- /annotations/src/tabs/VERSION: -------------------------------------------------------------------------------- 1 | #define AUTHOR "Frank B. Brokken (f.b.brokken@rug.nl)" 2 | #define VERSION "2.00.00" 3 | #define YEARS "1999-2014" 4 | -------------------------------------------------------------------------------- /annotations/src/tabs/data.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | bool g_entab = false; 4 | bool g_quiet = false; 5 | 6 | size_t g_minSpaces = 4; 7 | size_t g_tabWidth = 8; 8 | -------------------------------------------------------------------------------- /annotations/src/tabs/globals.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_GLOBALS_H_ 2 | #define INCLUDED_GLOBALS_H_ 3 | 4 | #include 5 | 6 | extern size_t g_minSpaces; 7 | extern size_t g_tabWidth; 8 | extern bool g_entab; 9 | extern bool g_quiet; 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /annotations/src/tabs/main.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | int main(int argc, char **argv) 4 | try 5 | { 6 | if (not arguments(argc, argv)) 7 | return 0; 8 | 9 | argv += optind; 10 | argc -= optind; 11 | 12 | Tabber tabber; 13 | 14 | if (argv[0][0] == '-') 15 | tabber.run(); 16 | 17 | if (not process(argv, tabber)) 18 | return 1; 19 | } 20 | catch (...) 21 | { 22 | return 1; 23 | } 24 | -------------------------------------------------------------------------------- /annotations/src/tabs/normalfile.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | bool normalFile(char const *fileName) 4 | { 5 | struct stat fileInfo; 6 | 7 | if (lstat(fileName, &fileInfo)) 8 | { 9 | cout << "Can't stat `" << fileName << "': skipping\n"; 10 | return false; 11 | } 12 | 13 | return S_ISREG(fileInfo.st_mode); 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /annotations/src/tabs/tabber/frame: -------------------------------------------------------------------------------- 1 | #include "tabber.ih" 2 | 3 | Tabber:: 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /annotations/src/tabs/tabber/incColumn.cc: -------------------------------------------------------------------------------- 1 | #include "tabber.ih" 2 | 3 | bool Tabber::tabColumn() 4 | { 5 | return ++d_column % g_tabWidth == 0; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/src/tabs/tabber/outspaces.cc: -------------------------------------------------------------------------------- 1 | #include "tabber.ih" 2 | 3 | void Tabber::outSpaces() 4 | { 5 | if (d_nSpaces != 0) 6 | d_out << setw(d_nSpaces) << ' '; 7 | d_nSpaces = 0; 8 | } 9 | -------------------------------------------------------------------------------- /annotations/src/tabs/tabber/run.cc: -------------------------------------------------------------------------------- 1 | #include "tabber.ih" 2 | 3 | void Tabber::run() 4 | { 5 | d_column = 0; 6 | 7 | if (g_entab) 8 | entab(); 9 | else 10 | detab(); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/src/tabs/tabber/run2.cc: -------------------------------------------------------------------------------- 1 | #include "tabber.ih" 2 | 3 | void Tabber::run(char const *inName, char const *outName) 4 | { 5 | ifstream in(inName); 6 | ofstream out(outName); 7 | 8 | d_in.rdbuf(in.rdbuf()); 9 | d_out.rdbuf(out.rdbuf()); 10 | 11 | run(); 12 | } 13 | -------------------------------------------------------------------------------- /annotations/src/tabs/tabber/tab.cc: -------------------------------------------------------------------------------- 1 | #include "tabber.ih" 2 | 3 | void Tabber::tab() 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /annotations/src/tabs/tabber/tabber.ih: -------------------------------------------------------------------------------- 1 | #include "tabber.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "../globals.h" 8 | 9 | using namespace std; 10 | 11 | -------------------------------------------------------------------------------- /annotations/src/tabs/tabber/tabber1.cc: -------------------------------------------------------------------------------- 1 | #include "tabber.ih" 2 | 3 | Tabber::Tabber() 4 | : 5 | d_in(cin.rdbuf()), 6 | d_out(cout.rdbuf()) 7 | {} 8 | -------------------------------------------------------------------------------- /annotations/src/tabs/version.cc: -------------------------------------------------------------------------------- 1 | // version.cc 2 | 3 | #include "main.ih" 4 | #include "icmconf" 5 | 6 | #ifdef USE_VERSION 7 | #include "VERSION" 8 | #endif 9 | 10 | #ifndef AUTHOR 11 | #define AUTHOR "" 12 | #endif 13 | 14 | #ifndef VERSION 15 | #define VERSION "0.00.00" 16 | #endif 17 | 18 | #ifndef YEARS 19 | #define YEARS "2012" 20 | #endif 21 | 22 | namespace Icmbuild 23 | { 24 | char version[] = VERSION; 25 | char years[] = YEARS; 26 | 27 | char author[] = AUTHOR; 28 | } 29 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/append.OBS: -------------------------------------------------------------------------------- 1 | #include 2 | #include "append.h" 3 | 4 | int main() 5 | { 6 | std::cout << 7 | Append, int>::List::size << '\n' << 8 | Prefix>::List::size << '\n'; 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/basename1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | class Base 5 | { 6 | public: 7 | void member(); 8 | }; 9 | template 10 | void Base::member() 11 | { 12 | std::cout << "This is Base::member()\n"; 13 | } 14 | template 15 | class Derived: public Base 16 | { 17 | public: 18 | Derived(); 19 | }; 20 | template 21 | Derived::Derived() 22 | { 23 | member(); 24 | } 25 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/CLASSES: -------------------------------------------------------------------------------- 1 | calculatorerror 2 | simulatorerror 3 | errorsource 4 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/calculatorerror/calculatorerror.ih: -------------------------------------------------------------------------------- 1 | #include "calculatorerror.h" 2 | 3 | #include 4 | #include 5 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/calculatorerror/data.cc: -------------------------------------------------------------------------------- 1 | #include "calculatorerror.ih" 2 | 3 | #include "calculatorerror.ih" 4 | 5 | // define the singleton 6 | CalculatorCategory const calculatorCategory; 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/calculatorerror/makeerrorcode.cc: -------------------------------------------------------------------------------- 1 | #include "calculatorerror.ih" 2 | 3 | //makecalcerrc 4 | std::error_code make_error_code(CalculatorError ce) 5 | { 6 | return { static_cast(ce), calculatorCategory }; 7 | } 8 | //= 9 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/calculatorerror/name.cc: -------------------------------------------------------------------------------- 1 | #include "calculatorerror.ih" 2 | 3 | char const *CalculatorCategory::name() const noexcept 4 | { 5 | return "calculator"; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/errorsource/data.cc: -------------------------------------------------------------------------------- 1 | #include "errorsource.ih" 2 | 3 | // define the singleton 4 | ErrorCategory const errorCategory; 5 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/errorsource/errorsource.ih: -------------------------------------------------------------------------------- 1 | #include "errorsource.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "../calculatorerror/calculatorerror.h" 9 | #include "../simulatorerror/simulatorerror.h" 10 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/errorsource/makeerrorcondition.cc: -------------------------------------------------------------------------------- 1 | #include "errorsource.ih" 2 | 3 | std::error_condition make_error_condition(ErrorSource ec) 4 | { 5 | std::cerr << __FILE__ ": error source = " << (int)ec << '\n'; 6 | 7 | return {static_cast(ec), errorCategory}; 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/errorsource/name.cc: -------------------------------------------------------------------------------- 1 | #include "errorsource.ih" 2 | 3 | char const *ErrorCategory::name() const noexcept 4 | { 5 | return "error-source"; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/main.ih: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | // #include 4 | // // #include 5 | // #include 6 | 7 | #include "calculatorerror/calculatorerror.h" 8 | #include "simulatorerror/simulatorerror.h" 9 | 10 | #include "errorsource/errorsource.h" 11 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/simulatorerror/data.cc: -------------------------------------------------------------------------------- 1 | #include "simulatorerror.ih" 2 | 3 | SimulatorCategory const simulatorCategory; 4 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/simulatorerror/makeerrorcode.cc: -------------------------------------------------------------------------------- 1 | #include "simulatorerror.ih" 2 | 3 | std::error_code make_error_code(SimulatorError ce) 4 | { 5 | return { static_cast(ce), simulatorCategory }; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/simulatorerror/name.cc: -------------------------------------------------------------------------------- 1 | #include "simulatorerror.ih" 2 | 3 | char const *SimulatorCategory::name() const noexcept 4 | { 5 | return "simulator"; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode.1/simulatorerror/simulatorerror.ih: -------------------------------------------------------------------------------- 1 | #include "simulatorerror.h" 2 | 3 | #include 4 | #include 5 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/CLASSES: -------------------------------------------------------------------------------- 1 | // specific error categories, defined for this program 2 | calculatorcategory 3 | simulatorcategory 4 | 5 | // classes handling all error conditions 6 | conditioncategory 7 | errorcondition 8 | 9 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/calculatorcategory/calculatorcategory.ih: -------------------------------------------------------------------------------- 1 | #include "calculatorcategory.h" 2 | 3 | #include 4 | 5 | #include "../calculatorerror/calculatorerror.h" 6 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/calculatorcategory/instance.cc: -------------------------------------------------------------------------------- 1 | #include "calculatorcategory.ih" 2 | 3 | //impl 4 | CalculatorCategory &CalculatorCategory::instance() 5 | { 6 | if (s_instance == 0) 7 | s_instance = new CalculatorCategory; 8 | 9 | return *s_instance; 10 | } 11 | //= 12 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/calculatorcategory/makeerrorcode.cc: -------------------------------------------------------------------------------- 1 | #include "calculatorcategory.ih" 2 | 3 | //impl 4 | std::error_code make_error_code(CalculatorError ce) 5 | { 6 | return { static_cast(ce), CalculatorCategory::instance() }; 7 | } 8 | //= 9 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/calculatorcategory/message.cc: -------------------------------------------------------------------------------- 1 | #include "calculatorcategory.ih" 2 | 3 | //impl 4 | std::string CalculatorCategory::message(int ev) const 5 | { 6 | return CategoryBase::message( 7 | ev, "CalculatorError not recognized"); 8 | } 9 | //= 10 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/calculatorcategory/name.cc: -------------------------------------------------------------------------------- 1 | #include "calculatorcategory.ih" 2 | 3 | char const *CalculatorCategory::name() const noexcept 4 | { 5 | return "calculator"; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/conditioncategory/conditioncategory.ih: -------------------------------------------------------------------------------- 1 | #include "conditioncategory.h" 2 | 3 | using namespace std; 4 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/conditioncategory/conditioncategory1.cc: -------------------------------------------------------------------------------- 1 | #include "conditioncategory.ih" 2 | 3 | ConditionCategory::ConditionCategory() 4 | : 5 | d_conditionInfo(1, { "", "(Condition not defined)" }) // avoid 0 numbers 6 | {} 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/conditioncategory/data.cc: -------------------------------------------------------------------------------- 1 | #include "conditioncategory.ih" 2 | 3 | ConditionCategory *ConditionCategory::s_instance; 4 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/conditioncategory/instance.cc: -------------------------------------------------------------------------------- 1 | #include "conditioncategory.ih" 2 | 3 | // static 4 | ConditionCategory &ConditionCategory::instance() 5 | { 6 | if (s_instance == 0) 7 | s_instance = new ConditionCategory; 8 | 9 | return *s_instance; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/conditioncategory/message.cc: -------------------------------------------------------------------------------- 1 | #include "conditioncategory.ih" 2 | 3 | std::string ConditionCategory::message(int ce) const 4 | { 5 | return 6 | std::get<1>( 7 | d_conditionInfo[ 8 | static_cast(ce) >= d_conditionInfo.size() ? 0 : ce 9 | ] 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/conditioncategory/name.cc: -------------------------------------------------------------------------------- 1 | #include "conditioncategory.ih" 2 | 3 | char const *ConditionCategory::name() const noexcept 4 | { 5 | return "error-condition"; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/errorcondition/addcondition.cc: -------------------------------------------------------------------------------- 1 | #include "errorcondition.ih" 2 | 3 | void ErrorCondition::addCondition( 4 | char const *name, char const *description) 5 | { 6 | if (d_condition.find(name) != d_condition.end()) 7 | throw std::logic_error( 8 | name + std::string{ " condition already defined" }); 9 | 10 | d_condition.insert( 11 | ConditionMap::value_type{name, d_ec.size()} 12 | ); 13 | 14 | d_ec.addCondition(name, description); 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/errorcondition/data.cc: -------------------------------------------------------------------------------- 1 | #include "errorcondition.ih" 2 | 3 | ErrorCondition *ErrorCondition::s_instance; 4 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/errorcondition/errorcondition.ih: -------------------------------------------------------------------------------- 1 | #include "errorcondition.h" 2 | 3 | #include 4 | #include 5 | #include 6 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/errorcondition/errorcondition1.cc: -------------------------------------------------------------------------------- 1 | #include "errorcondition.ih" 2 | 3 | ErrorCondition::ErrorCondition() 4 | : 5 | d_ec(ConditionCategory::instance()) 6 | {} 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/errorcondition/functor.cc: -------------------------------------------------------------------------------- 1 | #include "errorcondition.ih" 2 | 3 | ErrorCondition::Enum ErrorCondition::operator()(char const *conditionName) const 4 | { 5 | auto iter = d_condition.find(conditionName); 6 | 7 | return iter == d_condition.end() ? 8 | Enum{} 9 | : // return the vector index as Enum 10 | static_cast(iter->second); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/errorcondition/instance.cc: -------------------------------------------------------------------------------- 1 | #include "errorcondition.ih" 2 | 3 | //static 4 | ErrorCondition &ErrorCondition::instance() 5 | { 6 | if (s_instance == 0) 7 | s_instance = new ErrorCondition; 8 | 9 | return *s_instance; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/errorcondition/makeerrrorcondition.cc: -------------------------------------------------------------------------------- 1 | #include "errorcondition.ih" 2 | 3 | //make 4 | std::error_condition make_error_condition(ErrorCondition::Enum ec) 5 | { 6 | return { static_cast(ec), ConditionCategory::instance() }; 7 | } 8 | //= 9 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/main.ih: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "calculatorerror/calculatorerror.h" 9 | #include "calculatorcategory/calculatorcategory.h" 10 | 11 | #include "simulatorerror/simulatorerror.h" 12 | #include "simulatorcategory/simulatorcategory.h" 13 | 14 | #include "errorcondition/errorcondition.h" 15 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/simulatorcategory/instance.cc: -------------------------------------------------------------------------------- 1 | #include "simulatorcategory.ih" 2 | 3 | SimulatorCategory &SimulatorCategory::instance() 4 | { 5 | if (s_instance == 0) 6 | s_instance = new SimulatorCategory; 7 | 8 | return *s_instance; 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/simulatorcategory/makeerrorcode.cc: -------------------------------------------------------------------------------- 1 | #include "simulatorcategory.ih" 2 | 3 | std::error_code make_error_code(SimulatorError ce) 4 | { 5 | return { static_cast(ce), SimulatorCategory::instance() }; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/simulatorcategory/message.cc: -------------------------------------------------------------------------------- 1 | #include "simulatorcategory.ih" 2 | 3 | std::string SimulatorCategory::message(int ce) const 4 | { 5 | return CategoryBase::message( 6 | ce, "SimulatorError not recognized"); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/simulatorcategory/name.cc: -------------------------------------------------------------------------------- 1 | #include "simulatorcategory.ih" 2 | 3 | char const *SimulatorCategory::name() const noexcept 4 | { 5 | return "simulator"; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/errcode/simulatorcategory/simulatorcategory.ih: -------------------------------------------------------------------------------- 1 | #include "simulatorcategory.h" 2 | 3 | #include 4 | 5 | #include "../simulatorerror/simulatorerror.h" 6 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/inttype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_INTTYPE_H_ 2 | #define INCLUDED_INTTYPE_H_ 3 | 4 | template 5 | struct IntType 6 | { 7 | enum { value = nr } ; 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/listsearch.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "listsearch.h" 3 | 4 | int main() 5 | { 6 | //EXAMPLE 7 | std::cout << 8 | ListSearch>::index << "\n" << 9 | ListSearch>::index << "\n"; 10 | //= 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/listsize.OBS: -------------------------------------------------------------------------------- 1 | #include 2 | #include "listsize.h" 3 | 4 | int main() 5 | { 6 | std::cout << ListSize::size << "\n"; 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/listsize.h: -------------------------------------------------------------------------------- 1 | #include "typelist.h" 2 | 3 | //LISTSIZE 4 | template 5 | struct ListSize; 6 | //= 7 | 8 | //NULLTYPE 9 | template <> 10 | struct ListSize 11 | { 12 | enum { size = 0 }; 13 | }; 14 | //= 15 | 16 | //TYPELIST 17 | template 18 | struct ListSize > 19 | { 20 | enum { size = 1 + ListSize::size }; 21 | }; 22 | //= 23 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/nulltype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_NULLTYPE_H_ 2 | #define INCLUDED_NULLTYPE_H_ 3 | 4 | struct NullType 5 | {}; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/outer.cc: -------------------------------------------------------------------------------- 1 | template 2 | class Outer 3 | { 4 | public: 5 | class Nested 6 | {}; 7 | 8 | Nested nested() const; 9 | }; 10 | 11 | template 12 | Outer::Nested Outer::nested() const 13 | { 14 | return Nested{}; 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/storage.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_STORAGE_H_ 2 | #define INCLUDED_STORAGE_H_ 3 | 4 | #include 5 | 6 | template class Policy, 8 | template class Container = std::vector 9 | > 10 | class Storage: public Container> 11 | {}; 12 | 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/typelist.OBS: -------------------------------------------------------------------------------- 1 | #include "typelist.h" 2 | 3 | int main() 4 | { 5 | TypeList t3; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/typelist.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_TYPELIST_H_ 2 | #define INCLUDED_TYPELIST_H_ 3 | 4 | //TYPELIST 5 | template 6 | struct TypeList 7 | { 8 | TypeList(TypeList const &) = delete; 9 | enum { size = sizeof ...(Types) }; 10 | }; 11 | //= 12 | 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/typetype.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_TYPETYPE_H_ 2 | #define INCLUDED_TYPETYPE_H_ 3 | 4 | template 5 | struct TypeType 6 | { 7 | typedef TemplateType Type; 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/examples/uniq.OBS: -------------------------------------------------------------------------------- 1 | #include 2 | #include "uniq.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | cout << 9 | Uniq> 10 | ::List::size << '\n'; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/advancedtemplates/nulltype.yo: -------------------------------------------------------------------------------- 1 | At times (cf. section ref(TEMPLIST)) an empty 2 | hi(empty struct)hi(struct: empty)hi(NullType) 3 | tt(struct) is a useful tool. It can be used as a em(type) acting 4 | analogously to the final 0-byte in NTBSs. 5 | It can simply be defined as: 6 | verb( 7 | struct NullType 8 | {}; 9 | ) 10 | -------------------------------------------------------------------------------- /annotations/yo/classes/composition.yo: -------------------------------------------------------------------------------- 1 | In the class tt(Person) objects are used as data members. This construction 2 | technique is called emi(composition). 3 | 4 | Composition is neither extraordinary nor bf(C++) specific: in bf(C) 5 | a tt(struct) or tt(union) field is commonly used in other compound types. In 6 | bf(C++) it requires some special thought as their initialization sometimes is 7 | subject to restrictions, as discussed in the next few sections. 8 | -------------------------------------------------------------------------------- /annotations/yo/classes/examples/ambiguity.cc: -------------------------------------------------------------------------------- 1 | #include 2 | class Data 3 | { 4 | public: 5 | Data(); 6 | Data(int one); 7 | Data(int one, int two); 8 | 9 | void display(); 10 | }; 11 | 12 | void fun() 13 | { 14 | int b = 18; 15 | 16 | { 17 | Data(b); 18 | std::cout << b; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /annotations/yo/classes/examples/emptymain.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class Demo 5 | { 6 | public: 7 | Demo(); 8 | }; 9 | 10 | Demo::Demo() 11 | { 12 | cout << "Demo constructor called\n"; 13 | } 14 | 15 | Demo d; 16 | 17 | int main() 18 | {} 19 | 20 | /* 21 | Generated output: 22 | Demo constructor called 23 | */ 24 | -------------------------------------------------------------------------------- /annotations/yo/classes/examples/getmembers.cc: -------------------------------------------------------------------------------- 1 | #include "person.h" // given earlier 2 | using namespace std; 3 | 4 | string const &Person::name() const 5 | { 6 | return d_name; 7 | } 8 | string const &Person::address() const 9 | { 10 | return d_address; 11 | } 12 | string const &Person::phone() const 13 | { 14 | return d_phone; 15 | } 16 | size_t Person::mass() const 17 | { 18 | return d_mass; 19 | } 20 | -------------------------------------------------------------------------------- /annotations/yo/classes/examples/setmembers.cc: -------------------------------------------------------------------------------- 1 | #include "person.h" // given earlier 2 | using namespace std; 3 | 4 | void Person::setName(string const &name) 5 | { 6 | d_name = name; 7 | } 8 | void Person::setAddress(string const &address) 9 | { 10 | d_address = address; 11 | } 12 | void Person::setPhone(string const &phone) 13 | { 14 | d_phone = phone; 15 | } 16 | void Person::setMass(size_t mass) 17 | { 18 | d_mass = mass; 19 | } 20 | -------------------------------------------------------------------------------- /annotations/yo/classes/order.yo: -------------------------------------------------------------------------------- 1 | The possibility to pass arguments to constructors allows us to monitor the 2 | construction order of objects during program execution. This is illustrated 3 | by the next program using a class tt(Test). The program defines a global 4 | tt(Test) object and two local tt(Test) objects. The order of construction is 5 | as expected: first global, then main's first local object, then tt(func)'s 6 | local object, and then, finally, tt(main)'s second local object: 7 | verbinclude(-a examples/order.cc) 8 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/buffer.cc: -------------------------------------------------------------------------------- 1 | #include "buffer.h" 2 | 3 | int main(int argc) 4 | { 5 | Buffer b; // won't compile 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/buffer.h: -------------------------------------------------------------------------------- 1 | template 2 | class Buffer 3 | { 4 | public: 5 | Type 6 | buffer[size]; 7 | }; 8 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/converting/main.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | template 4 | void fun(Vehicle &vehicle) 5 | { 6 | cout << vehicle.mass() << '\n'; 7 | } 8 | 9 | int main(int argc, char **argv) 10 | { 11 | Car car; 12 | fun(car); 13 | 14 | Truck truck; 15 | fun(truck); 16 | } 17 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/extern.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | extern template class vector; 6 | 7 | void vectorUser() 8 | { 9 | vector vi; 10 | cout << vi.size() << '\n'; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/extern2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern void vectorUser(); 5 | 6 | int main() 7 | { 8 | vectorUser(); 9 | } 10 | 11 | // this part is never called. It is added to make sure all required 12 | // features of declared templates will also be instantiated. 13 | 14 | namespace 15 | { 16 | void instantiator() 17 | { 18 | std::vector vi; 19 | vi.size(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/forward2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | void caller(Fun fun, ArgType &&arg) 6 | { 7 | fun(std::forward(arg)); 8 | } 9 | 10 | void display(ostream &out) 11 | { 12 | out << "Hello fm display\n"; 13 | } 14 | 15 | void increment(int &x) 16 | { 17 | ++x; 18 | } 19 | 20 | int main() 21 | { 22 | int x = 0; 23 | caller(display, cout); 24 | caller(increment, x); 25 | cout << "x is now: " << x << '\n'; 26 | } 27 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/matrixdecl.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | class Matrix; 5 | 6 | template 7 | class Matrix<1, Columns, DataType>; 8 | 9 | Matrix<1, 12> *function(Matrix<2, 18, size_t> &mat); 10 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/static.cc: -------------------------------------------------------------------------------- 1 | template 2 | class TheClass 3 | { 4 | static int s_objectCounter; // declaration 5 | 6 | }; 7 | 8 | template // definition 9 | int TheClass::s_objectCounter = 0; 10 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/statictype.cc: -------------------------------------------------------------------------------- 1 | template 2 | class TheClass 3 | { 4 | static TheClass *s_objectPtr; 5 | }; 6 | 7 | template 8 | TheClass *TheClass::s_objectPtr = 0; 9 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/stringptr1.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_STRINGPTR_H_ 2 | #define INCLUDED_STRINGPTR_H_ 3 | 4 | #include 5 | #include 6 | 7 | class StringPtr: public std::vector 8 | { 9 | public: 10 | StringPtr(StringPtr const &other); 11 | ~StringPtr(); 12 | 13 | StringPtr &operator=(StringPtr const &other); 14 | }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/table/table.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "tablesupport/tablesupport.h" 5 | #include "table/table.h" 6 | 7 | namespace FBB 8 | { 9 | 10 | } 11 | 12 | using namespace std; 13 | using namespace FBB; 14 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/table/table/demo.cc: -------------------------------------------------------------------------------- 1 | #include "table.h" 2 | 3 | #ifndef SYSINC_STRING_ 4 | #include 5 | #define SYSINC_STRING_ 6 | #endif 7 | 8 | using namespace std; 9 | using namespace FBB; 10 | 11 | int main() 12 | { 13 | TableSupport ts; 14 | string s; 15 | 16 | Table 17 | tab 18 | ( 19 | s.begin(), 20 | s.end(), 21 | ts, 22 | 3, 23 | TableBase::HORIZONTAL 24 | ); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/table/tablesupport/destructor.cc: -------------------------------------------------------------------------------- 1 | #include "tablesupport.ih" 2 | 3 | TableSupport::~TableSupport() 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/table/tablesupport/tablesupport.ih: -------------------------------------------------------------------------------- 1 | #include "tablesupport.h" 2 | 3 | using namespace std; 4 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/table/tablesupport/tablesupport1.cc: -------------------------------------------------------------------------------- 1 | #include "tablesupport.ih" 2 | 3 | TableSupport::TableSupport() 4 | //: 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/table/tabletype/opinsert.cc: -------------------------------------------------------------------------------- 1 | #include "tabletype.ih" 2 | 3 | std::ostream &operator<<(std::ostream &str, FBB::TableType const &tableType) 4 | { 5 | return tableType.insert(str); 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/table/tabletype/setwidth.cc: -------------------------------------------------------------------------------- 1 | #include "tabletype.ih" 2 | 3 | void TableType::setWidth(WidthType type) 4 | { 5 | d_widthFun = 6 | ((d_widthType = type) == EQUALWIDTH) ? 7 | &TableType::maxWidth 8 | : 9 | &TableType::columnWidth; 10 | 11 | d_tableSupport.setParam(d_widthType == EQUALWIDTH ? d_maxWidth : 0); 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/table/tabletype/tabletype.ih: -------------------------------------------------------------------------------- 1 | #include "tabletype.h" 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | using namespace FBB; 8 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/examples/unboundfriends.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | class Wrapper; 5 | 6 | template 7 | class PtrVector 8 | { 9 | template 10 | friend 11 | PtrVector Wrapper::begin(Type1 const &t1, Type2 const &t2); 12 | 13 | void fun() 14 | {} 15 | 16 | double d_d; 17 | }; 18 | using namespace std; 19 | 20 | int main(int argc, char **argv) 21 | { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/vector/instantiate.cc: -------------------------------------------------------------------------------- 1 | #include "vector.h" 2 | 3 | void add(Vector &vector, int value) 4 | { 5 | vector.push_back(value); 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/vector/pushback.cc: -------------------------------------------------------------------------------- 1 | template 2 | T &Vector::operator[](size_t index) 3 | { 4 | if (index >= (beyond - data)) 5 | throw "Vector array index out of bounds"; 6 | return data[index]; 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/classtemplates/vector/vector1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "vector.h" 3 | 4 | int main() 5 | { 6 | Vector 7 | vi(10); 8 | 9 | cout << vi[5] << '\n'; 10 | vi.push_back(12); 11 | cout << vi[10] << '\n'; 12 | 13 | copy(vi.begin(), vi.end(), ostream_iterator(cout, " ")); 14 | cout << '\n'; 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/concrete/addtypes.yo: -------------------------------------------------------------------------------- 1 | These are the steps to take when another semantic data type must be added to 2 | an existing set: 3 | itemization( 4 | it() Add a tag name representing the new semantic value type to the 5 | tt(enum class Tag) (section ref(TAG)); 6 | it() Add a specialization to the tt(TagTrait) trait class (section 7 | ref(TAGTRAIT)) defining the added semantic value's data type, and whether or 8 | not the data on the parser's semantic stack should be considered (im)mutable. 9 | ) 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonc++/calculator.cc: -------------------------------------------------------------------------------- 1 | #include "parser/parser.h" 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | Parser parser; 8 | 9 | cout << "Enter (nested) expressions containing ints, doubles, *, + and " 10 | "unary -\n" 11 | "operators. Enter an empty line to stop.\n"; 12 | 13 | return parser.parse(); 14 | } 15 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonc++/parser/display1.cc: -------------------------------------------------------------------------------- 1 | #include "parser.ih" 2 | 3 | void Parser::display(int x) 4 | { 5 | cerr << "RPN: " << d_rpn.str() << '\n'; 6 | cerr << "int: " << x << '\n'; 7 | d_rpn.str(string()); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonc++/parser/display2.cc: -------------------------------------------------------------------------------- 1 | #include "parser.ih" 2 | 3 | void Parser::display(double x) 4 | { 5 | cerr << "RPN: " << d_rpn.str() << '\n'; 6 | cerr << "double: " << x << '\n'; 7 | d_rpn.str(string()); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonc++/parser/done.cc: -------------------------------------------------------------------------------- 1 | #include "parser.ih" 2 | 3 | void Parser::done() const 4 | { 5 | cout << "Good bye\n"; 6 | ACCEPT(); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonc++/parser/parser.ih: -------------------------------------------------------------------------------- 1 | // include this file in the sources of the class Parser, 2 | // and add any includes etc. that are only needed for 3 | // the compilation of these sources. 4 | 5 | // include the file defining the parser class: 6 | #include "parser.h" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | using FBB::A2x; 13 | using std::string; 14 | using std::cerr; 15 | using std::cout; 16 | using std::endl; 17 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonc++/parser/reset.cc: -------------------------------------------------------------------------------- 1 | #include "parser.ih" 2 | 3 | void Parser::reset() 4 | { 5 | d_rpn.clear(); 6 | d_rpn.str(string()); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonc++/scanner/lexer: -------------------------------------------------------------------------------- 1 | %interactive 2 | %filenames scanner 3 | 4 | %% 5 | 6 | [ \t] // ignored 7 | 8 | [0-9]+ return Parser::INT; 9 | 10 | "."[0-9]* | 11 | [0-9]+("."[0-9]*)? return Parser::DOUBLE; 12 | 13 | .|\n return matched()[0]; 14 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonc++/scanner/scanner.ih: -------------------------------------------------------------------------------- 1 | #include "scanner.h" 2 | #include "../parser/parserbase.h" 3 | 4 | // end of scanner.ih 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/bisonflexspec.yo: -------------------------------------------------------------------------------- 1 | The flex-specification file used by the calculator is simple: blanks are 2 | ignored, single characters are returned, and numeric values are returned as 3 | either tt(Parser::INT) or tt(Parser::DOUBLE) tokens. 4 | 5 | The tt(flexc++) directive tt(%interactive) is provided since the 6 | calculator is a program actively interacting with its human user. 7 | 8 | Here is the complete tt(flexc++) specification file: 9 | verbinclude(-a bisonc++/scanner/lexer) 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/a2xis.cc: -------------------------------------------------------------------------------- 1 | #include "a2x.h" 2 | 3 | A2x &A2x::operator=(char const *txt) 4 | { 5 | clear(); // very important!!! If a conversion failed, the object 6 | // remains useless until executing this statement 7 | str(txt); 8 | return *this; 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/bitand.h.OFF: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | struct bitAnd: public std::binary_function<_Tp, _Tp, _Tp> 5 | { 6 | _Tp &&operator()(_Tp const &__x, _Tp const &__y) const 7 | { 8 | return std::move(__x & __y); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/bitnot.h.OFF: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | struct bit_not: public std::unary_function<_Tp, _Tp> 5 | { 6 | _Tp &&operator()(_Tp const &__x) const 7 | { 8 | return _Tp(~__x); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/buildslurp: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -Wall parentslurp.cc fork.cc pipe.cc waitforchild.cc 4 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/command.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | class Command 6 | { 7 | std::string d_line; 8 | std::vector d_command; 9 | 10 | public: 11 | Command(size_t n, char const **commands) 12 | { 13 | copy(commands, commands + n, back_inserter(d_command)); 14 | } 15 | 16 | int next(std::string &line); 17 | }; 18 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/fistream/fisin: -------------------------------------------------------------------------------- 1 | ba10 hello world 2 | My+name+is+%60Ed%27 3 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/fistream/fistream.ih: -------------------------------------------------------------------------------- 1 | #include "fistream.h" 2 | 3 | // #include 4 | 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | using namespace FBB; 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/fork.cc: -------------------------------------------------------------------------------- 1 | #include "fork.ih" 2 | 3 | void Fork::fork() 4 | { 5 | if ((d_pid = ::fork()) < 0) 6 | throw "Fork::fork() failed"; 7 | 8 | if (d_pid == 0) // childprocess has pid == 0 9 | { 10 | childRedirections(); 11 | childProcess(); 12 | exit(1); // we shouldn't come here: 13 | } // childProcess() should exit 14 | 15 | parentRedirections(); 16 | parentProcess(); 17 | } 18 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/fork.ih: -------------------------------------------------------------------------------- 1 | #include "fork.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/forkvirtual.cc: -------------------------------------------------------------------------------- 1 | #include "fork.ih" 2 | 3 | //REDIRECT 4 | void Fork::childRedirections() 5 | {} 6 | void Fork::parentRedirections() 7 | {} 8 | //= 9 | 10 | Fork::~Fork() 11 | {} 12 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/ifdbuf.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ifdbuf.h" 4 | using namespace std; 5 | 6 | //MAIN 7 | int main() 8 | { 9 | IFdStreambuf fds(STDIN_FILENO); 10 | istream is(&fds); 11 | 12 | cout << is.rdbuf(); 13 | } 14 | //= 15 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/iterators/bidirectional.cc: -------------------------------------------------------------------------------- 1 | #include "bidirectional.h" 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | inplace_merge(BidirectionalIterator{ 0 }, BidirectionalIterator{ 100 }, 8 | BidirectionalIterator{ 200 }); 9 | next_permutation(BidirectionalIterator{ 0 }, 10 | BidirectionalIterator{ 100 }); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/iterators/forward.cc: -------------------------------------------------------------------------------- 1 | #include "forward.h" 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | adjacent_find(ForwardIterator{ 0 }, ForwardIterator{ 100 }); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/iterators/input.cc: -------------------------------------------------------------------------------- 1 | #include "input.h" 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | accumulate(InputIterator{ 0 }, InputIterator{ 100 }, 0); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/iterators/output.cc: -------------------------------------------------------------------------------- 1 | #include "input.h" 2 | #include "output.h" 3 | 4 | #include 5 | 6 | int main() 7 | { 8 | copy(InputIterator{ 0 }, InputIterator{ 100 }, OutputIterator{ 0 }); 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/iterators/random.cc: -------------------------------------------------------------------------------- 1 | #include "random.h" 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | sort(RandomIterator{ 0 }, RandomIterator{ 100 }); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/lines0.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | //LINES 5 | class Lines 6 | { 7 | std::vector d_line; 8 | 9 | public: 10 | Lines(std::istream &in); 11 | std::string &operator[](size_t idx); 12 | }; 13 | //= 14 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/monitor/build: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | g++ --std=c++11 *.cc ../selector.cc ../fork.cc ../forkvirtual.cc \ 4 | ../pipe.cc -lbobcat -s 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/monitor/createnewchild.cc: -------------------------------------------------------------------------------- 1 | #include "monitor.ih" 2 | 3 | //CHILD 4 | void Monitor::createNewChild(int, string const &) 5 | { 6 | Child *cp = new Child{ ++d_nr }; 7 | 8 | cp->fork(); 9 | 10 | int fd = cp->readFd(); 11 | 12 | d_selector.addReadFd(fd); 13 | d_child[fd].reset(cp); 14 | 15 | cerr << "Child " << d_nr << " started\n"; 16 | } 17 | //= 18 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/monitor/data.compiletime: -------------------------------------------------------------------------------- 1 | #include "monitor.ih" 2 | //HANDLER 3 | void (Monitor::*Monitor::s_handler[])(int, string const &) = 4 | { 5 | &Monitor::unknown, // order follows enum Command's 6 | &Monitor::createNewChild, // elements 7 | &Monitor::exiting, 8 | &Monitor::stopChild, 9 | &Monitor::sendChild, 10 | }; 11 | //= 12 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/monitor/monitor.ih: -------------------------------------------------------------------------------- 1 | #include "monitor.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "../ifdbuf.h" 11 | #include "../fdout.h" 12 | 13 | using namespace std; 14 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/monitor/processchild.cc: -------------------------------------------------------------------------------- 1 | #include "monitor.ih" 2 | //CHILD 3 | void Monitor::processChild(int fd) 4 | { 5 | IFdStreambuf ifdbuf(fd); 6 | istream istr(&ifdbuf); 7 | string line; 8 | 9 | getline(istr, line); 10 | cout << d_child[fd]->pid() << ": " << line << '\n'; 11 | } 12 | //= 13 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/monitor/sendchild.cc: -------------------------------------------------------------------------------- 1 | #include "monitor.ih" 2 | //SEND 3 | void Monitor::sendChild(int nr, string const &line) 4 | { 5 | auto it = find_if(d_child.begin(), d_child.end(), Find(nr)); 6 | 7 | if (it == d_child.end()) 8 | cerr << "No child number " << nr << '\n'; 9 | else 10 | { 11 | OFdnStreambuf ofdn{ it->second->writeFd() }; 12 | ostream out(&ofdn); 13 | 14 | out << line << '\n'; 15 | } 16 | } 17 | //= 18 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/monitor/stopchild.cc: -------------------------------------------------------------------------------- 1 | #include "monitor.ih" 2 | 3 | //STOP 4 | void Monitor::stopChild(int nr, string const &) 5 | { 6 | auto it = find_if(d_child.begin(), d_child.end(), Find{ nr }); 7 | 8 | if (it == d_child.end()) 9 | cerr << "No child number " << nr << '\n'; 10 | else 11 | { 12 | d_selector.rmReadFd(it->second->readFd()); 13 | d_child.erase(it); 14 | } 15 | } 16 | //= 17 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/monitor/unknown.cc: -------------------------------------------------------------------------------- 1 | #include "monitor.ih" 2 | 3 | void Monitor::unknown(int, string const &line) 4 | { 5 | cout << "unknown: " << line << "\n"; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/oformstream.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class oformstream: public std::ostream // 1 4 | { 5 | public: 6 | oformstream(std::ostream &ostr) // 2 7 | : 8 | std::ostream(ostr.rdbuf()) 9 | {} 10 | 11 | std::ostream &form(char const *fmt, ...); // 3 12 | 13 | }; 14 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/pipe.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //HEAD 4 | class Pipe 5 | { 6 | enum RW { READ, WRITE }; 7 | int d_fd[2]; 8 | //= 9 | public: 10 | Pipe(); 11 | int readOnly(); 12 | void readFrom(int fileDescriptor); 13 | int writeOnly(); 14 | void writtenBy(int fileDescriptor); 15 | void writtenBy(int const *fileDescriptors, size_t n = 2); 16 | private: 17 | void redirect(int d_fd, int alternateFd); 18 | }; 19 | -------------------------------------------------------------------------------- /annotations/yo/concrete/examples/waitforchild.cc: -------------------------------------------------------------------------------- 1 | #include "fork.ih" 2 | 3 | int Fork::waitForChild() 4 | { 5 | int status; 6 | 7 | waitpid(d_pid, &status, 0); 8 | 9 | return WEXITSTATUS(status); 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/childprocess/childprocess.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_CHILDPROCESS_H_ 2 | #define INCLUDED_CHILDPROCESS_H_ 3 | 4 | namespace FBB 5 | { 6 | class ChildProcess 7 | { 8 | public: 9 | virtual ~ChildProcess() 10 | {} 11 | void run(); 12 | 13 | protected: 14 | // implemented in derived classes 15 | virtual void executeChildProcess() = 0; 16 | }; 17 | } 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/childprocess/childprocess.ih: -------------------------------------------------------------------------------- 1 | #include "childprocess.h" 2 | 3 | #ifndef INCLUDED_CSTDLIB_ 4 | #include 5 | #define INCLUDED_CSTDLIB_ 6 | #endif 7 | 8 | using namespace FBB; 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/childprocess/run.cc: -------------------------------------------------------------------------------- 1 | #include "childprocess.ih" 2 | 3 | void ChildProcess::run() 4 | { 5 | executeChildProcess(); 6 | exit(-1); // doProcess itself should stop 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/cinredirector/childredirections.cc: -------------------------------------------------------------------------------- 1 | #include "cinredirector.ih" 2 | 3 | void CinRedirector::childRedirections() 4 | { 5 | // redirect STDIN_FILENO to the pipe: 6 | 7 | d_cinPipe.readVia(STDIN_FILENO); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/cinredirector/cinredirector.ih: -------------------------------------------------------------------------------- 1 | #include "cinredirector.h" 2 | 3 | #ifndef INCLUDED_UNISTD_H_ 4 | #include 5 | #define INCLUDED_UNISTD_H_ 6 | #endif 7 | 8 | using namespace FBB; 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/cinredirector/parentredirections.cc: -------------------------------------------------------------------------------- 1 | #include "cinredirector.ih" 2 | 3 | void CinRedirector::parentRedirections() 4 | { 5 | close(d_cinPipe.readFd()); 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/fork/forkfork.cc: -------------------------------------------------------------------------------- 1 | #include "fork.ih" 2 | 3 | void Fork::fork() const 4 | { 5 | int pid = ::fork(); 6 | 7 | if (pid == 0) // childprocess has pid == 0 8 | { 9 | d_redirector.childRedirections(); 10 | d_child.run(); 11 | } 12 | 13 | d_redirector.parentRedirections(); 14 | d_parent.run(pid, 15 | d_redirector.readChildCout(), 16 | d_redirector.readChildCerr(), 17 | d_redirector.writeChildCin()); 18 | } 19 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ifdnstreambuf/destructor.cc: -------------------------------------------------------------------------------- 1 | #include "ifdnstreambuf.ih" 2 | 3 | IFdNStreambuf::~IFdNStreambuf() 4 | { 5 | if (d_buffer) 6 | { 7 | close(d_fd); 8 | delete d_buffer; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ifdnstreambuf/ifdnstreambuf.ih: -------------------------------------------------------------------------------- 1 | #include "ifdnstreambuf.h" 2 | 3 | #include 4 | #include 5 | 6 | using namespace FBB; 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ifdnstreambuf/open.cc: -------------------------------------------------------------------------------- 1 | #include "ifdnstreambuf.ih" 2 | 3 | void IFdNStreambuf::open(int fd, size_t n) 4 | { 5 | d_fd = fd; 6 | d_n = (n == 0) ? 1 : n; 7 | 8 | d_buffer = new char[d_n]; 9 | setg(d_buffer, d_buffer + d_n, d_buffer + d_n); 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ifdnstreambuf/underflow.cc: -------------------------------------------------------------------------------- 1 | #include "ifdnstreambuf.ih" 2 | 3 | int IFdNStreambuf::underflow() 4 | { 5 | if (gptr() < egptr()) 6 | return *gptr(); 7 | 8 | int nread = read(d_fd, d_buffer, d_n); 9 | 10 | if (nread <= 0) 11 | return EOF; 12 | 13 | setg(d_buffer, d_buffer, d_buffer + nread); 14 | return static_cast(*gptr()); 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ofdnstreambuf/destructor.cc: -------------------------------------------------------------------------------- 1 | #include "ofdnstreambuf.ih" 2 | 3 | OFdNStreambuf::~OFdNStreambuf() 4 | { 5 | if (d_buffer) 6 | { 7 | sync(); 8 | delete d_buffer; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ofdnstreambuf/ofdnstreambuf.ih: -------------------------------------------------------------------------------- 1 | #include "ofdnstreambuf.h" 2 | 3 | #include 4 | #include 5 | 6 | using namespace FBB; 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ofdnstreambuf/open.cc: -------------------------------------------------------------------------------- 1 | #include "ofdnstreambuf.ih" 2 | 3 | void OFdNStreambuf::open(int fd, size_t n) 4 | { 5 | d_fd = fd; 6 | d_n = (n == 0) ? 1 : n; 7 | 8 | d_buffer = new char[d_n]; 9 | setp(d_buffer, d_buffer + d_n); 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ofdnstreambuf/overflow.cc: -------------------------------------------------------------------------------- 1 | #include "ofdnstreambuf.ih" 2 | 3 | int OFdNStreambuf::overflow(int c) 4 | { 5 | sync(); 6 | if (c != EOF) 7 | { 8 | *pptr() = c; 9 | pbump(1); 10 | } 11 | return c; 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/ofdnstreambuf/sync.cc: -------------------------------------------------------------------------------- 1 | #include "ofdnstreambuf.ih" 2 | 3 | int OFdNStreambuf::sync() 4 | { 5 | if (pptr() > pbase()) 6 | { 7 | write(d_fd, d_buffer, pptr() - pbase()); 8 | setp(d_buffer, d_buffer + d_n); 9 | } 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/opipe/opipe.cc: -------------------------------------------------------------------------------- 1 | #include "opipe.ih" 2 | 3 | OPipe::OPipe(size_t size) 4 | : 5 | Pipe(), 6 | OFdNStreambuf(Pipe::d_fd[READ], size == 0 ? 1 : size), 7 | ostream(this) 8 | {} 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/opipe/opipe.ih: -------------------------------------------------------------------------------- 1 | #include "opipe.h" 2 | 3 | using namespace FBB; 4 | using namespace std; 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/pipe/driver/driver.h: -------------------------------------------------------------------------------- 1 | // driver.h 2 | 3 | #ifndef H_driver_ 4 | #define H_driver_ 5 | 6 | /* 7 | $Id: driver.h 2 2003-05-27 19:11:03Z frank $ 8 | 9 | $Log$ 10 | Revision 1.1 2003/05/27 19:11:04 frank 11 | Initial revision 12 | 13 | */ 14 | 15 | //#include 16 | //#include 17 | //#include 18 | //#include 19 | //#include 20 | 21 | //using namespace std; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/pipe/dup.cc: -------------------------------------------------------------------------------- 1 | #include "pipe.ih" 2 | 3 | void Pipe::dup(RW rw, int fd) 4 | { 5 | if (dup2(d_fd[rw], fd) < 0) 6 | throw redirection_failed(); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/pipe/pipe.cc: -------------------------------------------------------------------------------- 1 | #include "pipe.ih" 2 | 3 | Pipe::Pipe() 4 | { 5 | if (pipe(d_fd)) 6 | throw bad_pipe(); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/pipe/pipe.ih: -------------------------------------------------------------------------------- 1 | #include "pipe.h" 2 | 3 | #ifndef INCLUDED_UNISTD_H_ 4 | #include 5 | #define INCLUDED_UNISTD_H_ 6 | #endif 7 | 8 | using namespace FBB; 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/pipe/readvia.cc: -------------------------------------------------------------------------------- 1 | #include "pipe.ih" 2 | 3 | void Pipe::readVia(int fd) 4 | { 5 | close(d_fd[WRITE]); 6 | dup(READ, fd); 7 | close(d_fd[READ]); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/pipe/readvia2.cc: -------------------------------------------------------------------------------- 1 | #include "pipe.ih" 2 | 3 | void Pipe::readVia(int const *fd, size_t n) 4 | { 5 | close(d_fd[WRITE]); 6 | 7 | for (size_t idx = 0; idx < n; idx++) 8 | dup(READ, fd[idx]); 9 | 10 | close(d_fd[READ]); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/pipe/writevia.cc: -------------------------------------------------------------------------------- 1 | #include "pipe.ih" 2 | 3 | void Pipe::writeVia(int fd) 4 | { 5 | close(d_fd[READ]); 6 | dup(WRITE, fd); 7 | close(d_fd[WRITE]); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/fork2/pipe/writevia2.cc: -------------------------------------------------------------------------------- 1 | #include "pipe.ih" 2 | 3 | void Pipe::writeVia(int const *fd, size_t n) 4 | { 5 | close(d_fd[READ]); 6 | 7 | for (size_t idx = 0; idx < n; idx++) 8 | dup(WRITE, fd[idx]); 9 | 10 | close(d_fd[WRITE]); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/concrete/header.yo: -------------------------------------------------------------------------------- 1 | Here is the specification of the header-section of our tt(bison++) 2 | specification file. Note the inclusion of the scanner's header file. 3 | verbinclude(-a parser/parser/gramspec/header.gr0) 4 | -------------------------------------------------------------------------------- /annotations/yo/concrete/lexer/in.1: -------------------------------------------------------------------------------- 1 | before 2 | #include 3 | #include 4 | after 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/lexer/in.2: -------------------------------------------------------------------------------- 1 | in in.2 2 | #include 3 | -------------------------------------------------------------------------------- /annotations/yo/concrete/lexer/lexer.cc: -------------------------------------------------------------------------------- 1 | #include "lexer.ih" 2 | 3 | int main(int argc, char **argv) 4 | try 5 | { 6 | if (argc == 1) 7 | { 8 | cerr << "Filename argument required\n"; 9 | return 1; 10 | } 11 | 12 | Scanner scanner(argv[1], "-"); 13 | 14 | scanner.setDebug(argc > 2); 15 | 16 | return scanner.lex(); 17 | } 18 | catch (exception const &exc) 19 | { 20 | cerr << exc.what() << '\n'; 21 | return 1; 22 | } 23 | -------------------------------------------------------------------------------- /annotations/yo/concrete/lexer/lexer.ih: -------------------------------------------------------------------------------- 1 | #include 2 | #include "scanner/scanner.h" 3 | 4 | using namespace std; 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/lexer/scanner/scanner.ih: -------------------------------------------------------------------------------- 1 | #include "scanner.h" 2 | 3 | using namespace std; 4 | -------------------------------------------------------------------------------- /annotations/yo/concrete/lexer/scanner/switchsource.cc: -------------------------------------------------------------------------------- 1 | #include "scanner.ih" 2 | 3 | void Scanner::switchSource() 4 | { 5 | pushStream(d_nextSource); 6 | begin(StartCondition__::INITIAL); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/base/base.ih: -------------------------------------------------------------------------------- 1 | #include "base.h" 2 | 3 | using namespace std; 4 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/base/clone.cc: -------------------------------------------------------------------------------- 1 | #include "base.ih" 2 | 3 | Base *Base::clone() const 4 | { 5 | return ownClone(); 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/input: -------------------------------------------------------------------------------- 1 | abc(def); 2 | xyz = 5; 3 | 4 | 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/main.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | int main(int argc, char **argv) 4 | { 5 | Parser parser; 6 | 7 | parser.setDebug(argc == 1); 8 | 9 | parser.parse(); 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/main.ih: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "parser/preinclude.h" 6 | #include "parser/parser.h" 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/parser/grammar: -------------------------------------------------------------------------------- 1 | %filenames parser 2 | %scanner ../scanner/scanner.h 3 | 4 | %baseclass-preinclude preinclude.h 5 | 6 | %stype Semantic 7 | 8 | %token INT IDENTIFIER 9 | 10 | %% 11 | 12 | rules: 13 | rules rule 14 | | 15 | rule 16 | ; 17 | 18 | rule: 19 | IDENTIFIER '(' IDENTIFIER ')' ';' 20 | { 21 | cout << $1 << " " << $3 << '\n'; 22 | } 23 | | 24 | IDENTIFIER '=' INT ';' 25 | { 26 | cout << $1 << " " << $3 << '\n'; 27 | } 28 | ; 29 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/parser/parser.ih: -------------------------------------------------------------------------------- 1 | // Include this file in the sources of the class Parser. 2 | 3 | // $insert class.h 4 | #include "parser.h" 5 | 6 | using namespace std; 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/parser/preinclude.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_PREINCLUDE_H_ 2 | #define INCLUDED_PREINCLUDE_H_ 3 | 4 | #include "../int/int.h" 5 | #include "../text/text.h" 6 | 7 | #include "../semantic/semantic.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly/scanner/scanner.h: -------------------------------------------------------------------------------- 1 | #ifndef SCANNER_H_ 2 | #define SCANNER_H_ 3 | 4 | #include "../semantic/semantic.h" 5 | 6 | #if ! defined(SKIP_FLEXLEXER_) && ! defined(SYSINC_FLEXLEXER_H_) 7 | #include 8 | #define SYSINC_FLEXLEXER_H_ 9 | #endif 10 | 11 | class Scanner: public yyFlexLexer 12 | { 13 | Semantic *d_semval; 14 | 15 | public: 16 | Scanner(Semantic *semval); 17 | int yylex(); 18 | }; 19 | 20 | inline Scanner::Scanner(Semantic *semval) 21 | : 22 | d_semval(semval) 23 | {} 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly2/input: -------------------------------------------------------------------------------- 1 | var = 5 ; 2 | var(var, 5, ok, 18); 3 | var(5); 4 | var(ok); 5 | 6 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly2/main.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | int main() 4 | { 5 | Parser parser; 6 | parser.parse(); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly2/main.ih: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "parser/parser.h" 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly2/parser/parser.ih: -------------------------------------------------------------------------------- 1 | // Include this file in the sources of the class Parser. 2 | 3 | // $insert class.h 4 | #include "parser.h" 5 | 6 | #include 7 | 8 | using namespace std; 9 | using namespace FBB; 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly2/scanner/lexer: -------------------------------------------------------------------------------- 1 | %filenames scanner 2 | 3 | %% 4 | 5 | [[:space:]]+ // skip white space 6 | 7 | [[:digit:]]+ return Parser::INT; 8 | 9 | [[:alpha:]_][[:alnum:]_]* return Parser::IDENT; 10 | 11 | . return matched()[0]; 12 | 13 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly2/scanner/scanner.ih: -------------------------------------------------------------------------------- 1 | // Declare here 2 | // what's only used in the Scanner class 3 | // and let Scanner's sources include "scanner.ih" 4 | 5 | #include "scanner.h" 6 | 7 | #include "../parser/parserbase.h" 8 | 9 | // end of scanner.ih 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly2/sembase/destructor.cc: -------------------------------------------------------------------------------- 1 | #include "sembase.h" 2 | 3 | SemBase::~SemBase() 4 | {} 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/poly2/spsembase/spsembase.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_SPSEMBASE_ 2 | #define INCLUDED_SPSEMBASE_ 3 | 4 | #include "../sembase/sembase.h" 5 | 6 | class spSemBase: public std::shared_ptr 7 | { 8 | public: 9 | spSemBase() = default; 10 | 11 | template 12 | spSemBase(Type *obj); 13 | }; 14 | 15 | template 16 | inline spSemBase::spSemBase(Type *obj) 17 | : 18 | std::shared_ptr(obj) 19 | {} 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /annotations/yo/concrete/semscanner.yo: -------------------------------------------------------------------------------- 1 | The scanner for the polymorphic parser is simple and only needs to recognize 2 | numbers, identifiers and some simple characters, returned as character 3 | tokens. Here is the scanner's complete specification file, as used by 4 | ti(flexc++): 5 | verbinclude(-a poly2/scanner/lexer) 6 | -------------------------------------------------------------------------------- /annotations/yo/concrete/spsembase.yo: -------------------------------------------------------------------------------- 1 | The parser uses tt(spSemBase) as its semantic value. The class tt(spSemBase) 2 | is a wrapper around tt(std::shared_ptr), offering a constructor 3 | member template which must be given a pointer to a dynamically allocated 4 | tt(Semantic) object. Its interface is all that is required: 5 | verbinclude(-a poly2/spsembase/spsembase.h) 6 | -------------------------------------------------------------------------------- /annotations/yo/concrete/streambuf/fdstreambuf/fdin2cout.cc: -------------------------------------------------------------------------------- 1 | #include "fdstreambuf.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | // Calls uflow() repeatedly 9 | 10 | int main(int argc) 11 | { 12 | fdstreambuf 13 | fds(0, ios::in); 14 | istream 15 | is(&fds); 16 | 17 | cout << "START\n"; 18 | 19 | char 20 | c; 21 | 22 | while (is.get(c)) 23 | cout << "GOT " << c << '\n'; 24 | 25 | cout << "Using fds(0)\n"; 26 | } 27 | -------------------------------------------------------------------------------- /annotations/yo/concrete/streambuf/fdstreambuf/fdinextracttocout.cc: -------------------------------------------------------------------------------- 1 | #include "inok/buf.1.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | // Calls uflow() repeatedly 9 | 10 | int main(int argc) 11 | { 12 | fdstreambuf 13 | fds(0, ios::in); 14 | istream 15 | is(&fds); 16 | 17 | cerr << "START\n"; 18 | 19 | char 20 | c; 21 | 22 | while (is >> c) 23 | cerr << "\t\tGOT " << c << '\n'; 24 | 25 | cerr << "Using fds(0)\n"; 26 | } 27 | -------------------------------------------------------------------------------- /annotations/yo/concrete/streambuf/fdstreambuf/fdinputback.cc: -------------------------------------------------------------------------------- 1 | #include "inok/buf.1.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main(int argc) 9 | { 10 | fdstreambuf 11 | fds(0, ios::in); 12 | istream 13 | is(&fds); 14 | 15 | cout << "START\n"; 16 | 17 | char 18 | c; 19 | 20 | is.get(c); 21 | 22 | cout << c << '\n'; 23 | 24 | is.unget(); 25 | 26 | cout << is.rdbuf(); 27 | } 28 | -------------------------------------------------------------------------------- /annotations/yo/concrete/streambuf/fdstreambuf/fdinrdbuf.cc: -------------------------------------------------------------------------------- 1 | #include "inok/buf.1.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | // Calls uflow() repeatedly 9 | 10 | int main(int argc) 11 | { 12 | fdstreambuf 13 | fds(0, ios::in); 14 | istream 15 | is(&fds); 16 | 17 | cout << "START\n"; 18 | 19 | cout << &fds;//is.rdbuf(); 20 | 21 | cout.clear(); // because of cerr.eof() 22 | 23 | cout << "Using fds(0)\n"; 24 | } 25 | -------------------------------------------------------------------------------- /annotations/yo/concrete/streambuf/fdstreambuf/input: -------------------------------------------------------------------------------- 1 | s a 2 | a 3 | -------------------------------------------------------------------------------- /annotations/yo/concrete/tag.yo: -------------------------------------------------------------------------------- 1 | Our program handles three types of semantic values: numbers, text, and 2 | vectors of semantic values, which are either numbers or text. These distinct 3 | types are indicated by em(tag) enumeration values: 4 | verbinclude(//TAG poly2/sembase/sembase.h) 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/tagtrait.yo: -------------------------------------------------------------------------------- 1 | The ti(TagTrait) trait class defines, for each of the distinct semantic 2 | values, what the actual data type (tt(DataType)) is that is associated with 3 | the tag and whether the data are mutable or immutable. Mutable data 4 | on the parser's semantic stack may be modified, immutable data may not. 5 | 6 | Here is the tt(TagTrait) meta template struct template and its specializations 7 | for the three data types used by our parser. 8 | verbinclude(//TRAITTAG poly2/sembase/sembase.h) 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/CLASSES: -------------------------------------------------------------------------------- 1 | semantic 2 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/input: -------------------------------------------------------------------------------- 1 | abc(def); 2 | xyz = 5; 3 | 4 | 5 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/main.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | int main(int argc, char **argv) 4 | { 5 | Parser parser; 6 | 7 | parser.setDebug(argc == 1); 8 | 9 | parser.parse(); 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/main.ih: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "parser/preinclude.h" 6 | #include "parser/parser.h" 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/parser/parser.ih: -------------------------------------------------------------------------------- 1 | // Include this file in the sources of the class Parser. 2 | 3 | // $insert class.h 4 | #include "parser.h" 5 | 6 | using namespace std; 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/parser/preinclude.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_PREINCLUDE_H_ 2 | #define INCLUDED_PREINCLUDE_H_ 3 | 4 | #include "../semantic/semantic.h" 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/semantic/destructor.cc: -------------------------------------------------------------------------------- 1 | #include "semantic.ih" 2 | 3 | Semantic::~Semantic() 4 | { 5 | if (d_int.first == IDENTIFIER) 6 | d_str.second.~string(); // destroy the string's memory 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/semantic/operatorassign.cc: -------------------------------------------------------------------------------- 1 | #include "semantic.ih" 2 | 3 | Semantic &Semantic::operator=(Semantic const &rhs) 4 | { 5 | Semantic tmp(rhs); 6 | swap(tmp); 7 | return *this; 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/semantic/operatorinsert.cc: -------------------------------------------------------------------------------- 1 | #include "semantic.ih" 2 | 3 | std::ostream &operator<<(std::ostream &out, Semantic const &obj) 4 | { 5 | if (obj.d_int.first == Semantic::IDENTIFIER) 6 | out << obj.d_str.second; 7 | else 8 | out << obj.d_int.second; 9 | 10 | return out; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/semantic/semantic.ih: -------------------------------------------------------------------------------- 1 | #include "semantic.h" 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/semantic/semantic1.cc: -------------------------------------------------------------------------------- 1 | #include "semantic.ih" 2 | 3 | Semantic::Semantic(Type type, char const *txt) 4 | { 5 | d_int.first = static_cast(type); 6 | 7 | if (type == IDENTIFIER) 8 | new (&d_str.second) string(txt); 9 | else 10 | { 11 | istringstream in(txt); 12 | in >> d_int.second; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/semantic/semantic2.cc: -------------------------------------------------------------------------------- 1 | #include "semantic.ih" 2 | 3 | Semantic::Semantic(Semantic const &other) 4 | : 5 | d_int(other.d_int) // blunt copy of d_int 6 | { 7 | if (d_int.first == IDENTIFIER) // if a string: copy it 8 | new (&d_str.second) string(other.d_str.second); 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/concrete/unrestricted/semantic/swap.cc: -------------------------------------------------------------------------------- 1 | #include "semantic.ih" 2 | 3 | void Semantic::swap(Semantic &other) 4 | { 5 | char buffer[sizeof(Semantic)]; 6 | 7 | memcpy(buffer, this, sizeof(Semantic)); 8 | memcpy(this, &other, sizeof(Semantic)); 9 | memcpy(&other, buffer, sizeof(Semantic)); 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/containers/examples/prioritywords1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | priority_queue q; 9 | string word; 10 | 11 | while (cin >> word) 12 | q.push(word); 13 | 14 | while (q.size()) 15 | { 16 | cout << q.top() << '\n'; 17 | q.pop(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /annotations/yo/containers/examples/vector.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main() 8 | try 9 | { 10 | vector vi; 11 | 12 | // vi[0] = 12; // segfaults 13 | vi.at(0) = 12; // throws an exception 14 | } 15 | catch (std::exception const &exc) 16 | { 17 | cerr << typeid(exc).name() << ' ' << exc.what() << '\n'; 18 | } 19 | -------------------------------------------------------------------------------- /annotations/yo/containers/mapexample.yo: -------------------------------------------------------------------------------- 1 | As mentioned at the beginning of section ref(MAP), the tt(map) represents 2 | a sorted associative array. In a tt(map) the keys are sorted. If an 3 | application must visit all elements in a map the tt(begin) and tt(end) 4 | iterators must be used. 5 | 6 | The following example illustrates how to make a simple table listing all keys 7 | and values found in a map: 8 | verbinclude(-a examples/maptable.cc) 9 | -------------------------------------------------------------------------------- /annotations/yo/containers/queue/front.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | queue 9 | q; 10 | 11 | q.push("Hello"); 12 | q.front() = "Hello World"; 13 | 14 | cout << q.front() << '\n'; 15 | 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /annotations/yo/cplusplus.idx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/yo/cplusplus.idx -------------------------------------------------------------------------------- /annotations/yo/exceptions/examples/errorcode.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | error_code ec{ make_error_code(errc::bad_address) }; 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/exceptions/examples/systemerror.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() 7 | try 8 | { 9 | try 10 | { 11 | throw system_error{2, system_category(), "system error thrown"}; 12 | } 13 | catch (system_error const &se) 14 | { 15 | cout << se.what() << ", " << se.code() << '\n'; 16 | throw; 17 | } 18 | } 19 | catch (exception const &ex) 20 | { 21 | cout << ex.what() << '\n'; 22 | } 23 | catch (...) 24 | { 25 | cout << "unknown\n"; 26 | } 27 | -------------------------------------------------------------------------------- /annotations/yo/exceptions/notry.cc: -------------------------------------------------------------------------------- 1 | 2 | int main() 3 | { 4 | throw "hello"; 5 | } 6 | -------------------------------------------------------------------------------- /annotations/yo/first/examples/initializer.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | void values(std::initializer_list iniValues) 5 | { 6 | } 7 | 8 | void values2(std::initializer_list> iniValues) 9 | { 10 | } 11 | 12 | int main() 13 | { 14 | values({2, 3, 5, 7, 11, 13}); 15 | values2({{1, 2}, {2, 3}, {3, 5}, {4, 7}, {5, 11}, {6, 13}}); 16 | } 17 | -------------------------------------------------------------------------------- /annotations/yo/first/examples/structured.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | struct Return 6 | { 7 | int first; 8 | double second; 9 | }; 10 | 11 | Return fun() 12 | { 13 | return Return{1, 12.5}; 14 | } 15 | 16 | Return &fun2() 17 | { 18 | static Return ret{4, 5}; 19 | return ret; 20 | } 21 | 22 | int main() 23 | { 24 | auto r1 = fun(); 25 | 26 | cout << r1.first; 27 | 28 | auto [one, two] = fun(); 29 | 30 | auto &&[rone, rtwo] = fun(); 31 | 32 | auto &[lone, ltwo] = fun2(); 33 | } 34 | -------------------------------------------------------------------------------- /annotations/yo/first/extensions.yo: -------------------------------------------------------------------------------- 1 | Before we continue with the `real' object-approach to programming, we first 2 | introduce some notable differences with the bf(C) programming language: not 3 | mere differences between bf(C) and bf(C++), but important syntactic constructs 4 | and keywords not found or differently used in bf(C). 5 | -------------------------------------------------------------------------------- /annotations/yo/first/first.yo: -------------------------------------------------------------------------------- 1 | In this chapter bf(C++) is further explored. The possibility to 2 | declare functions in tt(struct)s is illustrated in various examples; the 3 | concept of a tt(class) is introduced; casting is covered in detail; many new 4 | types are introduced and several important notational extensions to bf(C) are 5 | discussed. 6 | -------------------------------------------------------------------------------- /annotations/yo/first/longlongint.yo: -------------------------------------------------------------------------------- 1 | bf(C++) also supports the type ti(long long int). On 32 bit systems it has at 2 | least 64 usable bits. 3 | -------------------------------------------------------------------------------- /annotations/yo/first/separators.yo: -------------------------------------------------------------------------------- 1 | To improve the readability of large numbers 2 | em(digit separators)hi(digit separator) for integer and floating point 3 | literals can be used. The digit separator is a single quote which may be 4 | inserted between digits of such literals to enhance human 5 | readability. Multiple digit separators may be used, but only one separator can 6 | be inserted between successive digits. E.g., 7 | verb( 8 | 1'000'000 9 | 3.141'592'653'589'793'238'5 10 | ''123 // won't compile 11 | 1''23 // won't compile either 12 | ) 13 | -------------------------------------------------------------------------------- /annotations/yo/first/wchar.yo: -------------------------------------------------------------------------------- 1 | The ti(wchar_t) type is an extension of the tt(char) built-in type, to accommodate 2 | em(wide) character values (but see also the next section). The tt(g++) 3 | compiler reports tt(sizeof(wchar_t)) as 4, which easily accommodates all 65,536 4 | different em(Unicode) character values. 5 | 6 | Note that bf(Java)'s tt(char) data type is somewhat comparable to bf(C++)'s 7 | tt(wchar_t) type. bf(Java)'s tt(char) type is 2 bytes wide, though. On the 8 | other hand, bf(Java)'s tt(byte) data type is comparable to bf(C++)'s tt(char) 9 | type: one byte. Confusing? 10 | -------------------------------------------------------------------------------- /annotations/yo/friends.yo: -------------------------------------------------------------------------------- 1 | includefile(friends/intro) 2 | 3 | lsect(FriendsFriendfun)(Friend functions) 4 | includefile(friends/friendfun) 5 | 6 | sect(Extended friend declarations) 7 | includefile(friends/extended) 8 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/candidates.cc: -------------------------------------------------------------------------------- 1 | #include "candidates.h" 2 | 3 | int main() 4 | { 5 | differentSigns(int(), double()); 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/candidates.h: -------------------------------------------------------------------------------- 1 | template 2 | bool differentSigns(T t, U u); 3 | 4 | bool differentSigns(double i, double j); 5 | bool differentSigns(bool i, bool j); 6 | bool differentSigns(int (&i)[2]); 7 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/cast.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "add.h" 3 | 4 | size_t fun(size_t (*f)(size_t *p, size_t n)); 5 | double fun(double (*f)(double *p, size_t n)); 6 | 7 | int main() 8 | { 9 | std::cout 10 | << fun(static_cast(add)) 11 | << '\n'; 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/differentsigns.h: -------------------------------------------------------------------------------- 1 | template 2 | bool differentSigns(T v1, T v2) 3 | { 4 | return 5 | ( 6 | v1 < 0 && v2 >= 0 7 | || 8 | v1 >= 0 && v2 < 0 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/explicit.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "sumvector.h" 3 | 4 | size_t fun(size_t (*f)(size_t *p, size_t n)); 5 | double fun(double (*f)(double *p, size_t n)); 6 | 7 | int main(int argc, char **argv) 8 | { 9 | std::cout << fun(sumVector) << '\n'; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/fun1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "sumvector.h" 3 | #include "pointerunion.h" 4 | 5 | void fun() 6 | { 7 | PointerUnion 8 | pu = { sumVector }; 9 | 10 | std::cout << pu.vp << '\n'; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/fun2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "sumvector.h" 3 | #include "pointerunion.h" 4 | 5 | template 6 | T sumVector(T *tp, size_t n); 7 | 8 | void fun() 9 | { 10 | PointerUnion 11 | pu = { sumVector }; 12 | 13 | std::cout << pu.vp << '\n'; 14 | } 15 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/instantiate.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "sumvector.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | int x[] = {1, 2}; 9 | double y[] = {1.1, 2.2}; 10 | 11 | cout << sumVector(x, 2) << '\n' 12 | << sumVector(y, 2) << '\n'; 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/instantiatedecl.cc: -------------------------------------------------------------------------------- 1 | #include "sumvector.h" 2 | 3 | template int sumVector(int *, size_t); 4 | template double sumVector(double *, size_t); 5 | template size_t sumVector(size_t *, size_t); 6 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/main1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "sumvector.h" 3 | #include "pointerunion.h" 4 | 5 | void fun(); 6 | 7 | int main() 8 | { 9 | fun(); 10 | 11 | PointerUnion 12 | pu = { sumVector }; 13 | 14 | std::cout << pu.vp << '\n'; 15 | 16 | return 0; 17 | } 18 | /* 19 | Generated output (actual pointer values may be different): 20 | 21 | 0x8048710 22 | 0x8048710 23 | */ 24 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/nocompile.cc: -------------------------------------------------------------------------------- 1 | #include "sumvectorsize.h" 2 | 3 | int main() 4 | { 5 | int 6 | iArray[] = {1, 2, 3}, 7 | *iPtr = iArray; 8 | 9 | sumVector(iArray); // succeeds: size of iArray is known 10 | sumVector(iPtr); // fails: size of array pointed to by 11 | // iPtr is unknown 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/outerproduct.h: -------------------------------------------------------------------------------- 1 | template 2 | < 3 | class T1, 4 | class T2, 5 | size_t size1, 6 | size_t size2 7 | > 8 | T1 9 | ( 10 | *outerProduct 11 | ( 12 | T2 const (&v1)[size1], 13 | T2 const (&v2)[size2] 14 | ) 15 | )[size2]; 16 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/overloadfunction.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | T sumVector(std::vector &array) 6 | { 7 | return std::accumulate(array.begin(), array.end(), T()); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/pointerunion.h: -------------------------------------------------------------------------------- 1 | union PointerUnion 2 | { 3 | int (*fp)(int *, size_t); 4 | void *vp; 5 | }; 6 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/specialization.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "specialization.h" 3 | 4 | int main(int argc, char **argv) 5 | { 6 | std::cout << sumVector(argv, argc); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/specialization.h: -------------------------------------------------------------------------------- 1 | #include "sumvector.h" 2 | #include 3 | 4 | template <> char *sumVector(char **argv, size_t argc) 5 | { 6 | std::string s = std::accumulate(argv, argv + argc, std::string()); 7 | 8 | return strcpy(new char[s.size() + 1], s.c_str()); 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/cc.OBS/sumqueue.h: -------------------------------------------------------------------------------- 1 | template 2 | T sumVector(std::queue &queue) 3 | { 4 | T sum(); 5 | 6 | while (!queue.empty()) 7 | { 8 | sum += queue.front(); 9 | queue.pop(); 10 | } 11 | return sum; 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/add.h: -------------------------------------------------------------------------------- 1 | template 2 | Type add(Type const &lhs, Type const &rhs) 3 | { 4 | return lhs + rhs; 5 | } 6 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/add2.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | T add(T *array, size_t n) 5 | { 6 | return std::accumulate(array, array + n, T()); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/ambiguous.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "add.h" 3 | 4 | int fun(int (*f)(int const &lhs, int const &rhs)); 5 | double fun(double (*f)(double const &lhs, double const &rhs)); 6 | 7 | int main() 8 | { 9 | std::cout << fun(add) << '\n'; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/ambiguous2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "add.h" 3 | 4 | size_t fun(int (*f)(int *p, size_t n)); 5 | double fun(double (*f)(double *p, size_t n)); 6 | 7 | int main() 8 | { 9 | std::cout << fun(add); 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/cast.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "add.h" 3 | 4 | int fun(int (*f)(int const &lhs, int const &rhs)); 5 | double fun(double (*f)(double const &lhs, double const &rhs)); 6 | 7 | int main() 8 | { 9 | std::cout << fun( 10 | static_cast(add) 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/explicit.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "add.h" 3 | 4 | int fun(int (*f)(int const &lhs, int const &rhs)); 5 | double fun(double (*f)(double const &lhs, double const &rhs)); 6 | 7 | int main() 8 | { 9 | std::cout << fun(add) << '\n'; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/lvalue.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | void call(Type (*fp)(Type), Type const &value) 5 | { 6 | (*fp)(value); 7 | } 8 | int main() 9 | { 10 | call(sqrt, 2.0); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/main.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "add.h" 3 | #include "pointerunion.h" 4 | 5 | void fun(); 6 | 7 | int main() 8 | { 9 | PointerUnion pu = { add }; 10 | 11 | fun(); 12 | std::cout << pu.vp << '\n'; 13 | } 14 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/pointerunion.h: -------------------------------------------------------------------------------- 1 | union PointerUnion 2 | { 3 | int (*fp)(int const &, int const &); 4 | void *vp; 5 | }; 6 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/source1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "add.h" 3 | #include "pointerunion.h" 4 | 5 | void fun() 6 | { 7 | PointerUnion pu = { add }; 8 | 9 | std::cout << pu.vp << '\n'; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/source2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pointerunion.h" 3 | 4 | template 5 | Type add(Type const &, Type const &); 6 | 7 | void fun() 8 | { 9 | PointerUnion pu = { add }; 10 | 11 | std::cout << pu.vp << '\n'; 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/functiontemplates/examples/staticassert.cc: -------------------------------------------------------------------------------- 1 | template 2 | void rawswap(Type1 &type1, Type2 &type2) 3 | { 4 | static_assert(sizeof(Type1) != sizeof(Type2), 5 | "rawswap: Type1 and Type2 must have equal sizes"); 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/generic/examples/count.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int ia[] = {1, 2, 3, 4, 3, 4, 2, 1, 3}; 8 | 9 | cout << "Number of times the value 3 is available: " << 10 | count(ia, ia + sizeof(ia) / sizeof(int), 3) << 11 | '\n'; 12 | } 13 | // Displays: Number of times the value 3 is available: 3 14 | -------------------------------------------------------------------------------- /annotations/yo/generic/examples/exchange.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main(int argc, char **argv) 6 | { 7 | bool more = argc > 5; 8 | 9 | cout << "more than 5: " << exchange(more, argc > 2) << 10 | ", more than 2: " << more << '\n'; 11 | } 12 | /* 13 | Using g++ at least version 7.0.0: 14 | With `a.out one two three' displays: 15 | 16 | more than 5: 0, more than 2: 1 17 | 18 | */ 19 | -------------------------------------------------------------------------------- /annotations/yo/generic/examples/fill.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | vector iv(8); 10 | 11 | fill(iv.begin(), iv.end(), 8); 12 | 13 | copy(iv.begin(), iv.end(), ostream_iterator(cout, " ")); 14 | cout << '\n'; 15 | } 16 | // Displays: 8 8 8 8 8 8 8 8 17 | -------------------------------------------------------------------------------- /annotations/yo/generic/examples/filln.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | vector iv(8); 10 | 11 | fill_n(iv.begin() + 2, 4, 8); 12 | 13 | copy(iv.begin(), iv.end(), ostream_iterator(cout, " ")); 14 | cout << '\n'; 15 | } 16 | // Displays: 0 0 8 8 8 8 0 0 17 | -------------------------------------------------------------------------------- /annotations/yo/generic/examples/reverse.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | string line; 9 | 10 | while (getline(cin, line)) 11 | { 12 | reverse(line.begin(), line.end()); 13 | cout << line << '\n'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/generic/exchange.yo: -------------------------------------------------------------------------------- 1 | hi(exchange) 2 | itemization( 3 | it() Header file: tt() 4 | it() Function prototype: 5 | itemization( 6 | itt(Type exchange(Type &object1, ValueType &&newValue);) 7 | ) 8 | it() Description: 9 | itemization( 10 | it() tt(newValue) is assigned to tt(object1), and tt(object1's) 11 | previous value is returned. 12 | ) 13 | it() Example: 14 | verbinclude(-a examples/exchange.cc) 15 | ) 16 | -------------------------------------------------------------------------------- /annotations/yo/generic/heapdemo.yo: -------------------------------------------------------------------------------- 1 | Here is an example showing the various generic algorithms manipulating heaps: 2 | verbinclude(-a examples/heap.cc) 3 | -------------------------------------------------------------------------------- /annotations/yo/generic/iterswap.yo: -------------------------------------------------------------------------------- 1 | hi(iter_swap) 2 | itemization( 3 | it() Header file: tt() 4 | it() Function prototype: 5 | itemization( 6 | itt(void iter_swap(ForwardIterator1 iter1, 7 | ForwardIterator2 iter2);) 8 | ) 9 | it() Description: 10 | itemization( 11 | it() The elements pointed to by tt(iter1) and tt(iter2) are 12 | swapped. 13 | ) 14 | it() Example: 15 | verbinclude(-a examples/iterswap.cc) 16 | ) 17 | -------------------------------------------------------------------------------- /annotations/yo/generic/reverse.yo: -------------------------------------------------------------------------------- 1 | hi(reverse) 2 | itemization( 3 | it() Header file: 4 | tt() 5 | it() Function prototype: 6 | itemization( 7 | itt(void reverse(BidirectionalIterator first, 8 | BidirectionalIterator last);) 9 | ) 10 | it() Description: 11 | itemization( 12 | it() The elements in the range pointed to by rangett(first, last) 13 | are reversed. 14 | ) 15 | it() Example: 16 | verbinclude(-a examples/reverse.cc) 17 | ) 18 | -------------------------------------------------------------------------------- /annotations/yo/generic/swap.yo: -------------------------------------------------------------------------------- 1 | hi(swap) 2 | itemization( 3 | it() Header file: tt() 4 | it() Function prototype: 5 | itemization( 6 | itt(void swap(Type &object1, Type &object2);) 7 | ) 8 | it() Description: 9 | itemization( 10 | it() The elements tt(object1) and tt(object2) exchange their values. 11 | They do so by either cyclic copy assignment or cyclic move assignment (if 12 | available). 13 | ) 14 | it() Example: 15 | verbinclude(-a examples/swap.cc) 16 | ) 17 | -------------------------------------------------------------------------------- /annotations/yo/inheritance/conversions.yo: -------------------------------------------------------------------------------- 1 | When public inheritance is used to define classes, an object of a derived 2 | class em(is) at the same time an object of the base class. This has important 3 | consequences for object assignment and for the situation where pointers or 4 | references to such objects are used. Both situations are now discussed. 5 | -------------------------------------------------------------------------------- /annotations/yo/inheritance/examples/derivenew.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | struct Xstr: public string 9 | { 10 | Xstr() 11 | : 12 | string("hello world") 13 | {} 14 | }; 15 | 16 | int main() 17 | { 18 | string *sp = new Xstr[10]; 19 | copy(sp, sp + 10, ostream_iterator{ cout, "\n" }); 20 | } 21 | -------------------------------------------------------------------------------- /annotations/yo/intro/cplus.yo: -------------------------------------------------------------------------------- 1 | Each bf(C++) compiler which conforms to the i(ANSI/ISO) standard defines the 2 | symbol ti(__cplusplus): it is as if each source file were prefixed with the 3 | i(preprocessor directive) ti(#define __cplusplus). 4 | 5 | We shall see examples of the usage of this symbol in the following sections. 6 | -------------------------------------------------------------------------------- /annotations/yo/intro/differences.yo: -------------------------------------------------------------------------------- 1 | In this section some examples of bf(C++) code are shown. Some differences 2 | between bf(C) and bf(C++) are highlighted. 3 | -------------------------------------------------------------------------------- /annotations/yo/intro/examples/overload.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void show(int val) 4 | { 5 | printf("Integer: %d\n", val); 6 | } 7 | 8 | void show(double val) 9 | { 10 | printf("Double: %lf\n", val); 11 | } 12 | 13 | void show(char const *val) 14 | { 15 | printf("String: %s\n", val); 16 | } 17 | 18 | int main() 19 | { 20 | show(12); 21 | show(3.1415); 22 | show("Hello World!\n"); 23 | } 24 | -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/copycincout.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace::std; 3 | 4 | int main() 5 | { 6 | while (true) 7 | { 8 | char c; 9 | 10 | cin.get(c); 11 | if (cin.fail()) 12 | break; 13 | cout << c; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/copystreambuf.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | cin.ignore(80, '\n'); // skip the first line and... 7 | cout << cin.rdbuf(); // copy the rest through the streambuf * 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/cout.OBS: -------------------------------------------------------------------------------- 1 | #include 2 | #define VP (int) // (void *) 3 | 4 | int main() 5 | { 6 | int 7 | value = 15, 8 | *p = &value; 9 | 10 | cout << "Value: " << value << "\n" 11 | << "via p: " << *p << "\n" 12 | << "value's address: " << VP &value << "\n" 13 | << "address via p: " << VP p << "\n" 14 | << "p's address: " << VP &p << "\n"; 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/coutprintf.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "hel" << flush; 8 | printf("lo wo"); 9 | fflush(stdout); 10 | cout << "rld" << '\n'; 11 | } 12 | /* 13 | Generated output: 14 | 15 | hello world 16 | 17 | Without the flushes: 18 | 19 | helrld 20 | lo wo 21 | */ 22 | -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/hello: -------------------------------------------------------------------------------- 1 | hellohello -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/yo/iostreams/examples/index -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/isopen.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | ofstream of; 9 | 10 | cout << "of's open state: " << boolalpha << of.is_open() << '\n'; 11 | 12 | of.open("/dev/null"); // on Unix systems 13 | 14 | cout << "of's open state: " << of.is_open() << '\n'; 15 | } 16 | /* 17 | Generated output: 18 | of's open state: false 19 | of's open state: true 20 | */ 21 | -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/readdouble.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main(int argc, char **argv) 5 | { 6 | ifstream in(argv[1]); 7 | double value; 8 | 9 | // reads double in raw, binary form from file. 10 | in.read(reinterpret_cast(&value), sizeof(double)); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/stdio.OBS: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | stdiobuf 6 | f = fopen("stdio.cc", "r"); // open this source to read 7 | 8 | cout << &f; // copy it to cout 9 | 10 | fprintf(cout.rdbuf(), "hello world\n"); // append `hello world', using 11 | // a C function. 12 | return 0; 13 | 14 | /* 15 | output produced: 16 | 17 | the contents of this file, and an extra line 18 | containing the text `hello world' 19 | */ 20 | } 21 | -------------------------------------------------------------------------------- /annotations/yo/iostreams/examples/strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/yo/iostreams/examples/strings -------------------------------------------------------------------------------- /annotations/yo/memory/examples/copycons.cc: -------------------------------------------------------------------------------- 1 | class Class 2 | { 3 | public: 4 | Class() = default; 5 | Class(Class const &other) = default; 6 | Class(Class &&tmp) 7 | {} 8 | }; 9 | 10 | int main() 11 | { 12 | Class one; 13 | Class two{ one }; 14 | } 15 | -------------------------------------------------------------------------------- /annotations/yo/memory/examples/placement2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | //CODE 6 | using std::string; 7 | 8 | char buffer[3 * sizeof(string)]; 9 | string *sp = new(buffer) string [3]; 10 | 11 | for (size_t idx = 0; idx < 3; ++idx) 12 | sp[idx].~string(); 13 | //= 14 | } 15 | -------------------------------------------------------------------------------- /annotations/yo/memory/examples/strings.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //STRINGSTORE 4 | class Strings 5 | { 6 | std::string *d_string; 7 | size_t d_size; 8 | 9 | public: 10 | Strings(); 11 | Strings(char const *const *cStrings, size_t n); 12 | ~Strings(); 13 | 14 | std::string const &at(size_t idx) const; 15 | size_t size() const; 16 | }; 17 | //= 18 | -------------------------------------------------------------------------------- /annotations/yo/memory/examples/strings.ih: -------------------------------------------------------------------------------- 1 | #include "strings.h" 2 | 3 | using namespace std; 4 | -------------------------------------------------------------------------------- /annotations/yo/memory/examples/stringsmove.cc: -------------------------------------------------------------------------------- 1 | Strings::Strings(Strings &&tmp) 2 | : 3 | d_string(tmp.d_string), 4 | d_size(tmp.d_size), 5 | d_capacity(tmp.d_capacity) 6 | { 7 | tmp.d_string = 0; 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/memory/examples/stringstore.cc: -------------------------------------------------------------------------------- 1 | #include "strings.ih" 2 | 3 | //CONS 4 | Strings::Strings() 5 | : 6 | d_string(0), 7 | d_size(0) 8 | {} 9 | 10 | Strings::Strings(char const *const *cStrings, size_t size) 11 | : 12 | d_string(new string[size]), 13 | d_size(size) 14 | { 15 | for (size_t idx = 0; idx != size; ++idx) 16 | d_string[idx] = cStrings[idx]; 17 | } 18 | //= 19 | 20 | //DESTR 21 | Strings::~Strings() 22 | { 23 | delete[] d_string; 24 | } 25 | //= 26 | -------------------------------------------------------------------------------- /annotations/yo/memory/examples/stringstorenodelete.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "strings.h" 3 | using namespace std; 4 | 5 | Strings::~Strings() 6 | { 7 | cout << "Strings destructor called" << '\n'; 8 | } 9 | 10 | int main() 11 | { 12 | Strings **ptr = new Strings* [2]; 13 | 14 | ptr[0] = new Strings[2]; 15 | ptr[1] = new Strings[2]; 16 | 17 | delete[] ptr; 18 | } 19 | -------------------------------------------------------------------------------- /annotations/yo/memory/nocopycons.cc: -------------------------------------------------------------------------------- 1 | class Class 2 | { 3 | public: 4 | Class() = default; 5 | Class(Class &&tmp) 6 | {} 7 | }; 8 | 9 | int main() 10 | { 11 | Class one; 12 | Class two{ one }; 13 | } 14 | -------------------------------------------------------------------------------- /annotations/yo/namespaces/declaring.yo: -------------------------------------------------------------------------------- 1 | Instead of em(defining) entities in a namespace, entities may also be 2 | em(declared) in a namespace. This allows us to put all the 3 | hi(namespace declarations) declarations in a header file that can 4 | thereupon be included in sources using the entities defined in the 5 | namespace. Such a header file could contain, e.g., 6 | verb( 7 | namespace CppAnnotations 8 | { 9 | double cos(double degrees); 10 | double sin(double degrees); 11 | } 12 | ) 13 | -------------------------------------------------------------------------------- /annotations/yo/namespaces/examples/compound.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct Namespace 5 | { 6 | // using namespace std; cannot be used here 7 | std::string d_str; 8 | 9 | std::string text() const; 10 | }; 11 | 12 | int main() 13 | { 14 | using namespace std; // but here is OK 15 | 16 | string text; 17 | 18 | Namespace ns; 19 | 20 | cout << ns.text(); 21 | } 22 | -------------------------------------------------------------------------------- /annotations/yo/namespaces/examples/koenig1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace FBB 4 | { 5 | enum Value // defines FBB::Value 6 | { 7 | FIRST 8 | }; 9 | 10 | void fun(Value x) 11 | { 12 | std::cout << "fun called for " << x << '\n'; 13 | } 14 | } 15 | 16 | int main() 17 | { 18 | fun(FBB::FIRST); // Koenig lookup: no namespace 19 | // for fun() specified 20 | } 21 | /* 22 | generated output: 23 | fun called for 0 24 | */ 25 | -------------------------------------------------------------------------------- /annotations/yo/namespaces/examples/koenig4.cc: -------------------------------------------------------------------------------- 1 | namespace FBB 2 | { 3 | struct Value 4 | {}; 5 | 6 | void fun(int x); 7 | void gun(Value x); 8 | } 9 | 10 | namespace ES 11 | { 12 | void fun(int x) 13 | { 14 | fun(x); 15 | } 16 | void gun(FBB::Value x) 17 | { 18 | gun(x); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /annotations/yo/nested.yo: -------------------------------------------------------------------------------- 1 | includefile(nested/nesting) 2 | 3 | sect(Defining nested class members) 4 | includefile(nested/defining) 5 | 6 | sect(Declaring nested classes) 7 | includefile(nested/declaring) 8 | 9 | lsect(NESTEDFRIENDS)(Accessing private members in nested classes) 10 | includefile(nested/nestedfriends) 11 | 12 | sect(Nesting enumerations) 13 | includefile(nested/enumerations) 14 | 15 | lsubsect(EMPTYENUM)(Empty enumerations) 16 | includefile(nested/emptyenum) 17 | 18 | lsect(NESTEDVIRTCONS)(Revisiting virtual constructors) 19 | includefile(nested/virtcons.yo) 20 | -------------------------------------------------------------------------------- /annotations/yo/nested/examples/emptyenum.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | enum EmptyEnum 4 | {}; 5 | 6 | int main() 7 | try 8 | { 9 | throw EmptyEnum(); 10 | } 11 | catch (EmptyEnum) 12 | { 13 | std::cout << "Caught empty enum\n"; 14 | } 15 | -------------------------------------------------------------------------------- /annotations/yo/nested/using.yo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/yo/nested/using.yo -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/CLASSES: -------------------------------------------------------------------------------- 1 | binary 2 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/add.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | void Binary::add(Binary const &other) 4 | { 5 | cout << d_nr << ':' << d_copy << ".add(" << 6 | other.d_nr << ':' << other.d_copy << ")\n"; 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/binary.ih: -------------------------------------------------------------------------------- 1 | #include "binary.h" 2 | #include 3 | #include 4 | using namespace std; 5 | using namespace FBB; 6 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/binary0.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | Binary::Binary() 4 | : 5 | d_ip(new int), 6 | d_nr(s_copy.size() + 100), 7 | d_copy(s_copy[d_nr]++) 8 | { 9 | cout << "default constructor of object " << d_nr << ':' << d_copy << '\n'; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/binary1.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | Binary::Binary(size_t nr) 4 | : 5 | d_ip(new int), 6 | d_nr(nr), 7 | d_copy(s_copy[d_nr]++) 8 | { 9 | cout << d_nr << ':' << d_copy << '{' << nr << "}\n"; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/binary2.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | Binary::Binary(Binary const &other) 4 | : 5 | d_ip(new int), 6 | d_nr(other.d_nr), 7 | d_copy(s_copy[d_nr]++) 8 | { 9 | cout << d_nr << ':' << d_copy << '{' << 10 | other.d_nr << ':' << other.d_copy << "}\n"; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/binary3.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | Binary::Binary(Binary &&tmp) 4 | : 5 | d_ip(tmp.d_ip), 6 | d_nr(tmp.d_nr), 7 | d_copy(s_copy[d_nr]++) 8 | { 9 | tmp.d_ip = 0; 10 | cout << d_nr << ':' << d_copy << "{&&" << 11 | tmp.d_nr << ':' << tmp.d_copy << "}\n"; 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/data.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | std::unordered_map Binary::s_copy; 4 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/destructor.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | Binary::~Binary() 4 | { 5 | delete d_ip; 6 | // cout << "destructor of object " << d_nr << ':' << d_copy << '\n'; 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/operatoradd1.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | Binary operator+(Binary const &lhs, Binary const &rhs) 4 | { 5 | cout << lhs.d_nr << ':' << lhs.d_copy << " + " << 6 | rhs.d_nr << ':' << rhs.d_copy << '\n'; 7 | 8 | Binary tmp(lhs); 9 | tmp.add(rhs); 10 | return tmp; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/binary/operatoradd2.cc: -------------------------------------------------------------------------------- 1 | #include "binary.ih" 2 | 3 | Binary operator+(Binary &&lhs, Binary const &rhs) 4 | { 5 | cout << "&&" < " << 6 | rhs.d_nr << ':' << rhs.d_copy << '\n'; 7 | 8 | FBB::fswap(*this, rhs); 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary/main.ih: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "binary/binary.h" 5 | 6 | using namespace std; 7 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary1.cc: -------------------------------------------------------------------------------- 1 | class Binary 2 | { 3 | public: 4 | Binary(); 5 | Binary(int value); 6 | Binary operator+(Binary const &rhs); 7 | }; 8 | 9 | int main() 10 | { 11 | Binary b1; 12 | Binary b2{ 5 }; 13 | 14 | b1 = b2 + 3; // 1 15 | b1 = 3 + b2; // 2 16 | } 17 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary1.h: -------------------------------------------------------------------------------- 1 | class Binary 2 | { 3 | public: 4 | Binary(); 5 | Binary(int value); 6 | }; 7 | 8 | Binary operator+(Binary const &lhs, Binary const &rhs); 9 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary2.h: -------------------------------------------------------------------------------- 1 | class Binary 2 | { 3 | public: 4 | Binary(); 5 | Binary(int value); 6 | 7 | Binary &operator+=(Binary const &rhs); 8 | }; 9 | 10 | Binary operator+(Binary const &lhs, Binary const &rhs); 11 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binary3.h: -------------------------------------------------------------------------------- 1 | class Binary 2 | { 3 | friend Binary operator+(Binary const &lhs, Binary const &rhs); 4 | 5 | public: 6 | Binary(); 7 | Binary(int value); 8 | 9 | Binary &operator+=(Binary const &other); 10 | 11 | private: 12 | void add(Binary const &other); 13 | }; 14 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binaryadd1.cc: -------------------------------------------------------------------------------- 1 | Binary operator+(Binary const &lhs, Binary const &rhs) 2 | { 3 | Binary tmp{ lhs }; 4 | tmp.add(rhs); 5 | return tmp; 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binaryambigu.cc: -------------------------------------------------------------------------------- 1 | class A; 2 | 3 | class B 4 | { 5 | public: 6 | B(A const &a); 7 | }; 8 | 9 | class A 10 | { 11 | public: 12 | A(); 13 | A(B const &b); 14 | }; 15 | 16 | A operator+(A const &a, B const &b); 17 | B operator+(B const &b, A const &a); 18 | 19 | int main() 20 | { 21 | A a; 22 | 23 | a + a; 24 | }; 25 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/binarystring.cc: -------------------------------------------------------------------------------- 1 | std::string s1; 2 | std::string s2; 3 | std::string s3; 4 | 5 | s1 = s2 += s3; // 1 6 | (s2 += s3) + " postfix"; // 2 7 | s1 = "prefix " + s3; // 3 8 | "prefix " + s3 + "postfix"; // 4 9 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/intarray.ih: -------------------------------------------------------------------------------- 1 | #include "intarray.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/w10.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | std::ostream &w10(std::ostream &str) 5 | { 6 | return str << std::setw(10); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/overloading/examples/w10use.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | extern ostream &w10(ostream &str); 7 | 8 | int main() 9 | { 10 | w10(cout) << 3 << " ships sailed to America\n"; 11 | cout << "And " << w10 << 3 << " more ships sailed too.\n"; 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/overloading/more.yo: -------------------------------------------------------------------------------- 1 | Having covered the overloaded assignment operator in chapter ref(MEMORY), and 2 | having shown several examples of other overloaded operators as well (i.e., the 3 | insertion and extraction operators in chapters ref(FirstImpression) and 4 | ref(IOStreams)), we now take a look at i(operator overloading) in general. 5 | -------------------------------------------------------------------------------- /annotations/yo/pointermembers.yo: -------------------------------------------------------------------------------- 1 | includefile(pointermembers/intro) 2 | 3 | sect(Pointers to members: an example) 4 | includefile(pointermembers/example) 5 | 6 | sect(Defining pointers to members) 7 | includefile(pointermembers/defining) 8 | 9 | sect(Using pointers to members) 10 | includefile(pointermembers/using) 11 | 12 | sect(Pointers to static members) 13 | includefile(pointermembers/static) 14 | 15 | sect(Pointer sizes) 16 | includefile(pointermembers/sizes) 17 | -------------------------------------------------------------------------------- /annotations/yo/pointermembers/examples/casestring.OBS: -------------------------------------------------------------------------------- 1 | #include "casestring.h" 2 | 3 | string caseString::*caseString::stringMember[] = 4 | { 5 | &caseString::original, 6 | &caseString::lower, 7 | &caseString::upper, 8 | }; 9 | 10 | int main() 11 | { 12 | caseString hello("Hello World"); 13 | 14 | cout << hello << '\n'; 15 | hello.setMode(caseString::LOWER); 16 | cout << hello << '\n'; 17 | hello.setMode(caseString::UPPER); 18 | cout << hello << '\n'; 19 | hello.setMode(caseString::ORIGINAL); 20 | cout << hello << '\n'; 21 | } 22 | -------------------------------------------------------------------------------- /annotations/yo/pointermembers/examples/pointermembers.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | class X 7 | { 8 | public: 9 | 10 | void fun() { cout << "hello\n"; } 11 | 12 | void (X::*fp)(); 13 | 14 | string 15 | X::*sp, 16 | str; 17 | 18 | }; 19 | 20 | int main() 21 | { 22 | X x; 23 | 24 | x.fp = &X::fun; 25 | 26 | (x.*(x.fp))(); 27 | 28 | x.sp = &X::str; 29 | x.*(x.sp) = "hello world"; 30 | 31 | cout << x.str; 32 | } 33 | -------------------------------------------------------------------------------- /annotations/yo/polymorphism/examples/message.h: -------------------------------------------------------------------------------- 1 | #ifndef MESSAGEEXCEPTION_H_ 2 | #define MESSAGEEXCEPTION_H_ 3 | 4 | #include "exception.h" 5 | 6 | class MessageException: public Exception 7 | { 8 | public: 9 | MessageException(char const *reason) 10 | : 11 | Exception(reason) 12 | {} 13 | void process() const; 14 | }; 15 | #endif 16 | -------------------------------------------------------------------------------- /annotations/yo/polymorphism/examples/vtable.cc: -------------------------------------------------------------------------------- 1 | class Base 2 | { 3 | virtual void member(); 4 | }; 5 | inline void Base::member() 6 | {} 7 | class Derived: public Base 8 | { 9 | virtual void member(); // only declared 10 | }; 11 | int main() 12 | { 13 | Derived d; // Will compile, since all members were declared. 14 | // Linking will fail, since we don't have the 15 | // implementation of Derived::member() 16 | } 17 | -------------------------------------------------------------------------------- /annotations/yo/polymorphism/examples/warning.h: -------------------------------------------------------------------------------- 1 | #ifndef WARNINGEXCEPTION_H_ 2 | #define WARNINGEXCEPTION_H_ 3 | 4 | #include "exception.h" 5 | 6 | class Warning: public Exception 7 | { 8 | public: 9 | Warning(std::string const &reason) 10 | : 11 | Exception("Warning: " + reason) 12 | {} 13 | }; 14 | #endif 15 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/backinserter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | class Insertable 7 | { 8 | public: 9 | typedef int value_type; 10 | typedef int const &const_reference; 11 | 12 | void push_back(int const &) 13 | {} 14 | }; 15 | 16 | int main() 17 | { 18 | int arr[] = {1}; 19 | Insertable insertable; 20 | 21 | copy(arr, arr + 1, back_inserter(insertable)); 22 | } 23 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/bind.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main() 9 | { 10 | using namespace placeholders; 11 | 12 | vector vi {1, 9, 2, 8, 3, 7, 4, 6, 5}; 13 | 14 | cout << count_if(vi.begin(), vi.end(), 15 | bind(greater(), _1, 6)) << '\n'; 16 | 17 | cout << count_if(vi.begin(), vi.end(), 18 | bind(greater(), 6, _1)) << '\n'; 19 | } 20 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/deletertemplate.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | template 6 | struct Deleter 7 | { 8 | void operator()(Type * ptr) const 9 | { 10 | for (size_t idx = 0; idx < size; ++idx) 11 | delete ptr[idx]; 12 | delete ptr; 13 | } 14 | }; 15 | int main() 16 | { 17 | unique_ptr> sp2(new int *[10]); 18 | 19 | Deleter &obj = sp2.get_deleter(); 20 | } 21 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/geometric.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | std::linear_congruential_engine engine(0); 8 | 9 | std::geometric_distribution<> dist; 10 | 11 | for (size_t idx = 0; idx < 10; ++idx) 12 | std::cout << "a random value: " << dist(engine) << "\n"; 13 | 14 | std::cout << '\n' << 15 | dist.min() << " " << dist.max() << '\n'; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/insertcpp.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | unique_ptr sp(new string("Hello world")); 9 | 10 | cout << *sp << '\n'; 11 | sp->insert(strlen("Hello "), "C++ "); 12 | cout << *sp << '\n'; 13 | } 14 | /* 15 | Displays: 16 | Hello world 17 | Hello C++ world 18 | */ 19 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/iterator.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main(int argc, char **argv) 7 | { 8 | vector args(argv, argv + argc); 9 | 10 | for (auto iter = args.begin(); iter != args.end(); ++iter) 11 | cout << *iter << " "; 12 | cout << '\n'; 13 | 14 | for (auto iter = args.rbegin(); iter != args.rend(); ++iter) 15 | cout << *iter << " "; 16 | cout << '\n'; 17 | } 18 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/negate.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | int main(int argc, char **argv) 8 | { 9 | int iArr[] = { 1, -2, 3, -4, 5, -6 }; 10 | 11 | transform(iArr, iArr + 6, iArr, negate()); 12 | 13 | for (int idx = 0; idx < 6; ++idx) 14 | cout << iArr[idx] << ", "; 15 | cout << '\n'; 16 | } 17 | // Displays: -1, 2, -3, 4, -5, 6, 18 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/normal.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | std::mt19937 engine(time(0)); 9 | std::normal_distribution<> dist; 10 | 11 | for (size_t idx = 0; idx < 10; ++idx) 12 | std::cout << "a random value: " << dist(engine) << "\n"; 13 | 14 | cout << '\n' << 15 | dist.min() << " " << dist.max() << '\n'; 16 | } 17 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/oformstream.cc: -------------------------------------------------------------------------------- 1 | #include "oformstream.h" 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | oformstream of(cout.rdbuf()); 8 | 9 | of << "'"; 10 | 11 | of.form("%s %s", "hello", "world") << "'\n" 12 | << "======\n"; 13 | } 14 | /* Generated output: 15 | 'hello world' 16 | ====== 17 | */ 18 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/ostreamiterator.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | cin.unsetf(ios::skipws); 9 | copy(istream_iterator(cin), istream_iterator(), 10 | ostream_iterator(cout)); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/plusaccumulate.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | int main(int argc, char **argv) 8 | { 9 | string result = 10 | accumulate(argv, argv + argc, string(), plus()); 11 | 12 | cout << "All concatenated arguments: " << result << '\n'; 13 | } 14 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/regexreplace2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | int main() 9 | { 10 | //start 11 | regex re("([[:alpha:]]+)\\s+(\\d+)"); // letters blanks digits 12 | 13 | string target("this value 1024 is interesting"); 14 | 15 | regex_replace(ostream_iterator(cout, ""), target.begin(), 16 | target.end(), re, string("$2")); 17 | //= 18 | cout << '\n'; 19 | } 20 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/sharedinsert.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | shared_ptr sp(new string("Hello world")); 9 | shared_ptr sp2(sp); 10 | 11 | sp->insert(strlen("Hello "), "C++ "); 12 | cout << *sp << '\n' << 13 | *sp2 << '\n'; 14 | } 15 | /* 16 | Displays: 17 | Hello C++ world 18 | Hello C++ world 19 | */ 20 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/sharedptr.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | typedef shared_ptr si; 6 | int main() 7 | { 8 | si ip(new int(12)); 9 | 10 | cout << ip.unique() << '\n'; 11 | 12 | si ip2(ip); 13 | 14 | cout << ip.unique() << '\n'; 15 | 16 | si ip3 = ip; 17 | si ip4; 18 | cout << *ip << ip.use_count() << '\n'; 19 | } 20 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/streambufiter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | istreambuf_iterator in(cin.rdbuf()); 9 | istreambuf_iterator eof; 10 | ostreambuf_iterator out(cout.rdbuf()); 11 | 12 | copy(in, eof, out); 13 | } 14 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/uniqueother.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | unique_ptr hello1(new string("Hello world")); 10 | unique_ptr hello2(move(hello1)); 11 | unique_ptr hello3; 12 | 13 | hello3 = move(hello2); 14 | cout << // *hello1 << '\n' << // would have segfaulted 15 | // *hello2 << '\n' << // same 16 | *hello3 << '\n'; 17 | } 18 | // Displays: Hello world 19 | -------------------------------------------------------------------------------- /annotations/yo/stl/examples/uniqueptr.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | struct Move 8 | { 9 | Move() 10 | {} 11 | Move(Move &&tmp) 12 | {} 13 | ~Move() 14 | {} 15 | }; 16 | 17 | //typedef unique_ptr up; 18 | int main() 19 | { 20 | unique_ptr ip{ new ifstream{ "hi" } }; 21 | unique_ptr ip2{ move(ip) }; 22 | 23 | unique_ptr ip3{ new Move }; 24 | unique_ptr ip4{ move(ip3) }; 25 | } 26 | -------------------------------------------------------------------------------- /annotations/yo/stl/filesystem/examples/absolute.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // explicitly link against stdc++fs: 5 | // 6 | // gx absolute.cc -lstdc++fs 7 | 8 | namespace fs = std::experimental::filesystem; 9 | 10 | int main() 11 | { 12 | fs::path p{ "absolute.cc" }; 13 | 14 | 15 | std::cout << "Current path is " << fs::current_path() << '\n' << 16 | "Absolute path for " << p << " is " << 17 | fs::absolute(p) << '\n'; 18 | } 19 | -------------------------------------------------------------------------------- /annotations/yo/stl/filesystem/examples/directoryentry.cc: -------------------------------------------------------------------------------- 1 | // explicitly link against stdc++fs: 2 | // 3 | // gx directoryentry.cc -lstdc++fs 4 | 5 | //de 6 | #include 7 | #include 8 | 9 | namespace fs = std::experimental::filesystem; 10 | using namespace std; 11 | 12 | int main(int argc, char **argv) 13 | { 14 | fs::directory_entry de{argv[1]}; 15 | cout << de.path() << '\n'; 16 | 17 | de.replace_filename(argv[2]); 18 | cout << de.path() << '\n'; 19 | 20 | de.assign(argv[2]); 21 | cout << de.path() << '\n'; 22 | } 23 | //= 24 | -------------------------------------------------------------------------------- /annotations/yo/stl/filesystem/examples/path.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // explicitly link against stdc++fs: 5 | // 6 | // gx path.cc -lstdc++fs 7 | 8 | namespace fs = std::experimental::filesystem; 9 | 10 | int main() 11 | { 12 | fs::path p{ "/abs/olu/te.cc" }; 13 | 14 | 15 | p.replace_filename("this/part"); 16 | 17 | std::cout << "Current path is " << fs::current_path() << '\n' << 18 | "Absolute path for " << p << " is " << 19 | fs::absolute(p) << '\n'; 20 | } 21 | -------------------------------------------------------------------------------- /annotations/yo/string/examples/stringassign.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | string stringOne("Hello World"); 7 | string stringTwo; 8 | 9 | stringTwo = stringOne; // assign stringOne to stringTwo 10 | stringTwo = "Hello world"; // assign a C-string to StringTwo 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/string/examples/stringcstr.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | string stringOne("Hello World"); 8 | char const *cString = stringOne.c_str(); 9 | 10 | cout << cString << '\n'; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/string/examples/stringerase.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | string stringOne("Hello Cruel World"); 8 | 9 | stringOne.erase(5, 6); 10 | 11 | cout << stringOne << '\n'; 12 | 13 | stringOne.erase(); 14 | 15 | cout << "'" << stringOne << "'\n"; 16 | } 17 | -------------------------------------------------------------------------------- /annotations/yo/string/examples/stringinsert.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | string 8 | stringOne("Hell ok."); 9 | // Insert "o " at position 4 10 | stringOne.insert(4, "o "); 11 | 12 | string 13 | world("The World of C++"); 14 | 15 | // insert "World" into stringOne 16 | stringOne.insert(6, world, 4, 5); 17 | 18 | cout << "Guess what ? It is: " << stringOne << '\n'; 19 | } 20 | -------------------------------------------------------------------------------- /annotations/yo/string/examples/stringsize.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | string stringOne("Hello World"); 8 | 9 | cout << "The length of the stringOne string is " 10 | << stringOne.size() << " characters\n"; 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/string/examples/stringsubstr.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | string stringOne("Hello World"); 8 | 9 | cout << stringOne.substr(0, 5) << '\n' 10 | << stringOne.substr(6) << '\n' 11 | << stringOne.substr() << '\n'; 12 | } 13 | -------------------------------------------------------------------------------- /annotations/yo/string/examples/stringswap.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | string stringOne("Hello"); 8 | string stringTwo("World"); 9 | 10 | cout << "Before: stringOne: " << stringOne << ", stringTwo: " 11 | << stringTwo << '\n'; 12 | 13 | stringOne.swap(stringTwo); 14 | 15 | cout << "After: stringOne: " << stringOne << ", stringTwo: " 16 | << stringTwo << '\n'; 17 | } 18 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/alreadyretrieved.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | //code 5 | int main() 6 | { 7 | std::promise promise; 8 | promise.get_future(); 9 | promise.get_future(); 10 | } 11 | //= 12 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/async2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | //code 5 | void fun() 6 | { 7 | std::cerr << " hello from fun\n"; 8 | } 9 | 10 | std::future asyncCall(char const *label) 11 | { 12 | std::cerr << label << " async call starts\n"; 13 | auto ret = std::async(fun); 14 | std::cerr << label << " async call ends\n"; 15 | return ret; 16 | } 17 | 18 | int main() 19 | { 20 | asyncCall("First"); 21 | asyncCall("Second"); 22 | } 23 | //= 24 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/async3.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fun() 5 | { 6 | std::cerr << " hello from fun\n"; 7 | return 12; 8 | } 9 | 10 | int indirect(std::future &fut) 11 | { 12 | std::cerr << "calling indirect to obtain fun's results\n"; 13 | return fut.get(); 14 | } 15 | 16 | int main() 17 | { 18 | auto fut = std::async(fun); 19 | 20 | auto ret = std::async(std::launch::async, indirect, std::ref(fut)); 21 | std::cerr << "receiving from fun: " << ret.get() << '\n'; 22 | } 23 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/async4.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void fun() 5 | { 6 | std::cerr << " hello from fun\n"; 7 | } 8 | 9 | std::future asyncCall(char const *label) 10 | { 11 | std::cerr << label << " async call starts\n"; 12 | auto ret = std::async(fun); 13 | std::cerr << label << " async call ends\n"; 14 | return ret; 15 | } 16 | 17 | //code 18 | int main() 19 | { 20 | auto ret1 = asyncCall("First"); 21 | auto ret2 = asyncCall("Second"); 22 | 23 | ret1.get(); 24 | ret2.get(); 25 | } 26 | //= 27 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/brokenpromise.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | //code 5 | std::future fun() 6 | { 7 | return std::promise().get_future(); 8 | } 9 | 10 | int main() 11 | try 12 | { 13 | fun().get(); 14 | } 15 | catch (std::exception const &exc) 16 | { 17 | std::cerr << exc.what() << '\n'; 18 | } 19 | //= 20 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/clock.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | using namespace chrono; 5 | 6 | int main() 7 | { 8 | cout << system_clock::to_time_t(system_clock().now()) << '\n'; 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/cmdfork/childprocess.cc: -------------------------------------------------------------------------------- 1 | #include "cmdfork.ih" 2 | 3 | void CmdFork::childProcess() 4 | { 5 | vector args; 6 | String::split(&args, d_command); 7 | 8 | char *const *argv = const_cast(String::argv(args)); 9 | 10 | execv(argv[0], argv); 11 | 12 | throw Exception{ errno } << " thrown exception " << errno; 13 | } 14 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/cmdfork/childredirections.cc: -------------------------------------------------------------------------------- 1 | #include "cmdfork.ih" 2 | 3 | void CmdFork::childRedirections() 4 | { 5 | d_childOutput.writtenBy(STDERR_FILENO); 6 | } 7 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/cmdfork/cmdfork.ih: -------------------------------------------------------------------------------- 1 | #include "cmdfork.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | using namespace FBB; 12 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/cmdfork/cmdfork1.cc: -------------------------------------------------------------------------------- 1 | #include "cmdfork.ih" 2 | 3 | CmdFork::CmdFork(string const &command) 4 | : 5 | d_command(command) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/cmdfork/parentprocess.cc: -------------------------------------------------------------------------------- 1 | #include "cmdfork.ih" 2 | 3 | void CmdFork::parentProcess() 4 | { 5 | IFdStream fromChild(d_childOutput.readOnly()); 6 | 7 | // read the child's output 8 | d_command.clear(); 9 | 10 | string line; 11 | while (getline(fromChild, line)) 12 | d_command += line + '\n'; 13 | 14 | d_childExit = waitForChild(); 15 | } 16 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/detached1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | void action() 8 | { 9 | while (true) 10 | { 11 | cout << "Hello from detached" << endl; 12 | this_thread::sleep_for(chrono::seconds(1)); 13 | } 14 | } 15 | 16 | int main() 17 | { 18 | thread t(action); 19 | t.detach(); 20 | 21 | this_thread::sleep_for(chrono::seconds(4)); 22 | } 23 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/hello.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void hello() 5 | { 6 | std::cout << "hello world!\n"; 7 | } 8 | 9 | int main() 10 | { 11 | std::thread hi(hello); 12 | hi.join(); 13 | } 14 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/hwconcurrency.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | std::cout << std::thread::hardware_concurrency() << '\n'; 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/joinguard.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "joinguard.h" 3 | 4 | void childActions(); 5 | 6 | void doSomeWork() 7 | { 8 | throw std::runtime_error("doSomeWork throws"); 9 | } 10 | 11 | void parent() 12 | { 13 | JoinGuard{std::thread{childActions}}; 14 | doSomeWork(); 15 | } 16 | 17 | int main() 18 | try 19 | { 20 | parent(); 21 | } 22 | catch (std::exception const &exc) 23 | { 24 | std::cout << exc.what() << '\n'; 25 | } 26 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/joinguard.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class JoinGuard 4 | { 5 | std::thread d_thread; 6 | 7 | public: 8 | JoinGuard(std::thread &&threadObj) 9 | : 10 | d_thread(std::move(threadObj)) 11 | {} 12 | ~JoinGuard() 13 | { 14 | if (d_thread.joinable()) 15 | d_thread.join(); 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicmdfork/data.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | mutex g_coutMutex; 4 | mutex g_qsMutex; 5 | queue g_qs; 6 | 7 | Semaphore g_workforce(4); 8 | Semaphore g_worker(0); 9 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicmdfork/dispatch.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | void dispatch(string const &line) 4 | { 5 | g_workforce.wait(); 6 | { 7 | lock_guard lk(g_qsMutex); 8 | g_qs.push(line); 9 | } 10 | g_worker.notify_all(); 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicmdfork/files.in: -------------------------------------------------------------------------------- 1 | data.cc 2 | dispatch.cc 3 | main.cc 4 | process.cc 5 | data.cc 6 | dispatch.cc 7 | main.cc 8 | process.cc 9 | data.cc 10 | dispatch.cc 11 | main.cc 12 | process.cc 13 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicmdfork/files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for x in `cat files.in` 4 | do 5 | g++ --std=c++11 -c $x 6 | done 7 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicmdfork/main.ih: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "../semaphore/semaphore.h" 7 | #include "../cmdfork/cmdfork.h" 8 | 9 | using namespace std; 10 | 11 | extern mutex g_coutMutex; 12 | extern mutex g_qsMutex; 13 | extern queue g_qs; 14 | 15 | extern Semaphore g_workforce; 16 | extern Semaphore g_worker; 17 | 18 | void dispatch(string const &line); 19 | void process(int nr); 20 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/compile.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | Result compile(string const &line) 5 | { 6 | string command("/usr/bin/g++ -Wall --std=c++11 -c " + line); 7 | 8 | CmdFork cmdFork(command); 9 | cmdFork.fork(); 10 | 11 | Result ret {cmdFork.childExit() == 0, 12 | line + "\n" + cmdFork.childOutput()}; 13 | 14 | if (not ret.ok) 15 | g_done = true; 16 | 17 | return ret; 18 | } 19 | //= 20 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/data.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | TaskQueue g_taskQ; 4 | 5 | mutex g_resultQMutex; 6 | queue> g_resultQ; 7 | condition_variable g_resultCond; 8 | 9 | 10 | mutex g_readyMutex; 11 | atomic_bool g_ready; 12 | condition_variable g_readyCond; 13 | 14 | atomic_bool g_done; 15 | 16 | size_t g_sizeofWorkforce = 6; 17 | 18 | Semaphore g_workforce(g_sizeofWorkforce); 19 | Semaphore g_worker(0); 20 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/dispatch.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | bool dispatch(string const &line) 5 | { 6 | if (line.empty()) 7 | return true; 8 | 9 | if (g_done.load()) 10 | return false; 11 | 12 | g_workforce.wait(); 13 | newTask(line); 14 | g_worker.notify_all(); 15 | return true; 16 | } 17 | //= 18 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/files.in: -------------------------------------------------------------------------------- 1 | data.cc 2 | dispatch.cc 3 | main.cc 4 | worker.cc 5 | compile.cc 6 | workforce.cc 7 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for x in `cat $1` 4 | do 5 | echo $x 6 | g++ --std=c++11 -c $x 7 | done 8 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/jobs.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | void jobs() 5 | { 6 | string line; 7 | while (getline(cin, line) && dispatch(line)) 8 | ; 9 | 10 | g_ready = true; 11 | g_resultCond.notify_one(); 12 | } 13 | //= 14 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/main.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | int main() 5 | { 6 | workforce(); // start the worker threads 7 | thread(jobs).detach(); // start working on the jobs 8 | results(); // handle the results. 9 | } 10 | //= 11 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/main2.ih: -------------------------------------------------------------------------------- 1 | class Task 2 | { 3 | string d_command; 4 | PackagedTask d_task; 5 | 6 | public: 7 | Task() = default; 8 | 9 | Task(string const &command, PackagedTask &&tmp); 10 | void operator()(); 11 | shared_future result(); 12 | }; 13 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/newresult.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | bool newResult() 5 | { 6 | unique_lock lk(g_resultQMutex); 7 | 8 | while 9 | ( 10 | ( 11 | g_resultQ.empty() 12 | && 13 | g_workforce.size() != g_sizeofWorkforce 14 | ) 15 | || 16 | not g_ready.load() 17 | ) 18 | g_resultCond.wait(lk); 19 | 20 | return not g_resultQ.empty(); 21 | } 22 | //= 23 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/newtask.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | void newTask(string const &line) 5 | { 6 | Task task{ line, PackagedTask(compile) }; 7 | 8 | pushResultQ(task.result()); 9 | g_taskQ.push(move(task)); 10 | } 11 | //= 12 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/pushresultq.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | void pushResultQ(shared_future const &sharedResult) 5 | { 6 | lock_guard lk(g_resultQMutex); 7 | g_resultQ.push(sharedResult); 8 | g_ready = true; 9 | g_resultCond.notify_one(); 10 | } 11 | //= 12 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/results.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | void results() 5 | { 6 | while (newResult()) 7 | { 8 | Result const &result = g_resultQ.front().get(); 9 | 10 | cerr << result.display; 11 | if (not result.ok) 12 | return; 13 | 14 | g_resultQ.pop(); 15 | } 16 | } 17 | //= 18 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/worker.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | void worker() 5 | { 6 | Task task; 7 | 8 | while (true) 9 | { 10 | g_worker.wait(); 11 | 12 | g_taskQ.popFront(task); 13 | task(); 14 | 15 | g_workforce.notify_all(); 16 | } 17 | } 18 | //= 19 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multicompile/workforce.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | void workforce() 4 | { 5 | for (size_t idx = 0; idx != g_sizeofWorkforce; ++idx) 6 | thread(worker).detach(); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/data.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | vector g_data; 4 | 5 | TaskQueue g_workQ; 6 | 7 | TaskQueue g_taskQ; 8 | mutex g_taskMutex; 9 | condition_variable g_taskCondition; 10 | 11 | size_t g_sizeofWorkforce = 8; 12 | 13 | Semaphore g_workforce(g_sizeofWorkforce); 14 | Semaphore g_worker(0); 15 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/display.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | void display() 4 | { 5 | size_t nr = 0; 6 | for (auto el: g_data) 7 | cerr << el << (++nr % 10 == 0 ? '\n' : ' '); 8 | 9 | cerr << '\n'; 10 | } 11 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/main.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | int main() 4 | try 5 | { 6 | workForce(); // start the worker threads 7 | 8 | readData(); 9 | 10 | g_taskQ.push( // prepare the main task 11 | Pair(g_data.begin(), g_data.end()) 12 | ); 13 | 14 | scheduler(); 15 | 16 | display(); 17 | } 18 | catch (exception const &exc) 19 | { 20 | cerr << "Exception: " << exc.what() << '\n'; 21 | } 22 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/newtask.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | bool newTask() 5 | { 6 | bool done; 7 | 8 | unique_lock lk(g_taskMutex); 9 | while ((done = g_taskQ.empty()) && wip()) 10 | g_taskCondition.wait(lk); 11 | 12 | return not done; 13 | } 14 | //= 15 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/partition.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | void partition(Pair const &range) 5 | { 6 | if (range.second - range.first < 2) 7 | return; 8 | 9 | auto rhsBegin = partition(range.first + 1, range.second, 10 | bind2nd(less(), *range.first)); 11 | auto lhsEnd = rhsBegin - 1; 12 | 13 | swap(*range.first, *lhsEnd); 14 | 15 | pushTask(range.first, lhsEnd); 16 | pushTask(rhsBegin, range.second); 17 | } 18 | //= 19 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/pushtask.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | void pushTask(Iter const &begin, Iter const &end) 4 | { 5 | g_taskQ.push(Pair(begin, end)); 6 | 7 | lock_guard lk(g_taskMutex); 8 | g_taskCondition.notify_one(); 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/readdata.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | void readData() 4 | { 5 | int value; // read the data 6 | while (cin >> value) 7 | g_data.push_back(value); 8 | } 9 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/scheduler.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | void scheduler() 5 | { 6 | while (newTask()) 7 | { 8 | g_workQ.rawPushFront(g_taskQ); 9 | 10 | g_workforce.wait(); // wait for a worker to be available 11 | g_worker.notify_all(); // activate a worker 12 | } 13 | } 14 | //= 15 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/wip.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | bool wip() 5 | { 6 | return g_workforce.size() != g_sizeofWorkforce; 7 | } 8 | //= 9 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/worker.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | //code 4 | void worker() 5 | { 6 | while (true) 7 | { 8 | g_worker.wait(); // wait for action 9 | 10 | partition(g_workQ.popFront()); 11 | g_workforce.notify_all(); 12 | 13 | lock_guard lk(g_taskMutex); 14 | g_taskCondition.notify_one(); 15 | } 16 | } 17 | //= 18 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/multisort/workforce.cc: -------------------------------------------------------------------------------- 1 | #include "main.ih" 2 | 3 | void workForce() 4 | { 5 | for (size_t idx = 0; idx != g_sizeofWorkforce; ++idx) 6 | thread(worker).detach(); 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/nostate.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | //code 5 | int main() 6 | { 7 | std::future fut; 8 | fut.get(); 9 | } 10 | //= 11 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/packagedtask.in: -------------------------------------------------------------------------------- 1 | volkswagen caddy 2 | peugeot 304 3 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/promise0.cc: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | //code 5 | void compute(int *ret) 6 | { 7 | *ret = 9; 8 | } 9 | 10 | int main() 11 | { 12 | int ret = 0; 13 | std::thread(compute2, &ret).detach(); 14 | cout << ret << '\n'; 15 | } 16 | //= 17 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/promise1.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | //code 7 | void compute1(promise &ref) 8 | { 9 | ref.set_value(9); 10 | } 11 | 12 | int main() 13 | { 14 | std::promise p; 15 | std::thread(compute, ref(p)).detach(); 16 | 17 | cout << p.get_future().get() << '\n'; 18 | } 19 | //= 20 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/promisealreadysatisfied.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | //code 5 | int main() 6 | { 7 | std::promise promise; 8 | promise.set_value(15); 9 | promise.set_value(155); 10 | } 11 | //= 12 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/promisealreadysatisfied2.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | //code 6 | int main() 7 | { 8 | std::promise promise; 9 | promise.set_value(15); 10 | promise.set_exception(std::make_exception_ptr(std::exception())); 11 | } 12 | //= 13 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/random.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | using namespace FBB; 6 | 7 | int main() 8 | { 9 | IRandStream is(10000); 10 | 11 | for (int idx = 0; idx != 10000; ) 12 | { 13 | size_t value; 14 | is >> value; 15 | cout << value << ' '; 16 | if (++idx % 10 == 0) 17 | cout << '\n'; 18 | } 19 | cout << '\n'; 20 | } 21 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/semaphore/increase.cc: -------------------------------------------------------------------------------- 1 | #include "semaphore.ih" 2 | 3 | void Semaphore::notify_all() 4 | { 5 | lock_guard lk(d_mutex); // get the lock 6 | if (d_nAvailable++ == 0) 7 | d_condition.notify_all(); // use notify_one to notify one other 8 | // thread 9 | } 10 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/semaphore/reduce.cc: -------------------------------------------------------------------------------- 1 | #include "semaphore.ih" 2 | 3 | void Semaphore::wait() 4 | { 5 | unique_lock lk(d_mutex); // get the lock 6 | while (d_nAvailable == 0) 7 | d_condition.wait(lk); // internally releases the lock 8 | // and waits, on exit 9 | // acquires the lock again 10 | --d_nAvailable; // dec. semaphore 11 | } 12 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/semaphore/semaphore.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_SEMAPHORE_ 2 | #define INCLUDED_SEMAPHORE_ 3 | 4 | #include 5 | #include 6 | 7 | class Semaphore 8 | { 9 | mutable std::mutex d_mutex; 10 | std::condition_variable d_condition; 11 | size_t d_nAvailable; 12 | 13 | public: 14 | Semaphore(size_t nAvailable); 15 | 16 | void wait(); // wait # available 17 | void notify_all(); // notify_all # available, notify if initially 0 18 | 19 | size_t size() const; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/semaphore/semaphore.ih: -------------------------------------------------------------------------------- 1 | #include "semaphore.h" 2 | 3 | using namespace std; 4 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/semaphore/semaphore1.cc: -------------------------------------------------------------------------------- 1 | #include "semaphore.ih" 2 | 3 | Semaphore::Semaphore(size_t nAvailable) 4 | : 5 | d_nAvailable(nAvailable) 6 | {} 7 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/semaphore/size.cc: -------------------------------------------------------------------------------- 1 | #include "semaphore.ih" 2 | 3 | size_t Semaphore::size() const 4 | { 5 | lock_guard lk(d_mutex); // get the lock 6 | return d_nAvailable; 7 | } 8 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/simple.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | bool stop; 8 | 9 | void dots() 10 | { 11 | while (not stop) 12 | { 13 | cout.put('.').flush(); 14 | sleep(1); 15 | } 16 | } 17 | 18 | int main() 19 | { 20 | cout << "Press 'enter' to end this program" << endl; 21 | auto ret = async(std::launch::async, dots); 22 | cin.ignore(10, '\n'); 23 | stop = true; 24 | } 25 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/sleepuntil.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | using namespace chrono; 6 | 7 | void nowait() 8 | { 9 | cerr << "hello "; 10 | this_thread::sleep_until(system_clock().now() - seconds(5)); 11 | cerr << "world\n"; 12 | } 13 | 14 | int main() 15 | { 16 | thread(nowait).join(); 17 | } 18 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/terminate.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void hello() 5 | { 6 | while (true) 7 | std::cout << "hello world!\n"; 8 | } 9 | 10 | int main() 11 | { 12 | std::thread hi(hello); 13 | } 14 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/threadaction.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //code 4 | void threadAction(std::mutex &mut, int &sharedInt) 5 | { 6 | std::lock_guard lg{mut, std::adopt_lock_t()}; 7 | // do something with sharedInt 8 | } 9 | //= 10 | -------------------------------------------------------------------------------- /annotations/yo/threading/examples/throwing.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | //code 5 | void thrower() 6 | { 7 | throw std::exception(); 8 | } 9 | 10 | int main() 11 | try 12 | { 13 | std::thread subThread(thrower); 14 | } 15 | catch (...) 16 | { 17 | std::cerr << "Caught exception\n"; 18 | } 19 | //= 20 | -------------------------------------------------------------------------------- /annotations/yo/version.yo: -------------------------------------------------------------------------------- 1 | SUBST(DOCVERSION)(10.9.2) 2 | SUBST(YEARS)(1994-2018) 3 | -------------------------------------------------------------------------------- /annotations/zip/collect: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for x in svg eps gif 4 | do 5 | cd $x 6 | zip -mr $x.zip * 7 | mv $x.zip .. 8 | cd .. 9 | rmdir $x 10 | done 11 | -------------------------------------------------------------------------------- /annotations/zip/eps.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/zip/eps.zip -------------------------------------------------------------------------------- /annotations/zip/gif.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/zip/gif.zip -------------------------------------------------------------------------------- /annotations/zip/prepare: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xzip() 4 | { 5 | cd $1 6 | unzip ../$1.zip 7 | cd .. 8 | } 9 | 10 | mkdir -p eps gif svg 11 | 12 | xzip eps 13 | xzip gif 14 | xzip svg 15 | -------------------------------------------------------------------------------- /annotations/zip/svg.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/annotations/zip/svg.zip -------------------------------------------------------------------------------- /cppannotations/html/exceptions/systemerror.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbb-git/cppannotations/36b5cad8f8cb835febfcc9d66706d9aee2debe96/cppannotations/html/exceptions/systemerror.gif -------------------------------------------------------------------------------- /excluded: -------------------------------------------------------------------------------- 1 | .git 2 | .gitignore 3 | bin 4 | chist* 5 | esr.rejected 6 | excluded 7 | local 8 | sourceforge 9 | sourcetar 10 | tmp 11 | zip 12 | contributions/cplusplus.pt* 13 | contributions/s.bacchi 14 | --------------------------------------------------------------------------------