\ProvidesPackage{boost}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

%define a namespace environment that wraps the contents in namespace XXX { }
\newenvironment{namespace}[1]{{\texttt{namespace #1\\\{\\}}}{\texttt{\\\}\\}}
%macro to write out the start of a class definition, including template args and base classes
\newcommand{\boost@startclassdefinition}{%
\ifx\boost@classname\undefined%
\else%
\ifx\boost@startedclassdefinition\undefined%
{\def\boost@a{}%
\texttt{%
\ifx\boost@templateparams\boost@a\else{}{template \textless{} \boost@templateparams{} \textgreater{}}\\\fi%
class \boost@classname%
\ifx\boost@baseclasses\boost@a\else{} :\\\boost@baseclasses\fi%
\\\{\\}}%
\def\boost@startedclassdefinition{}\def\boost@templateparams{}\fi%
\fi}
%macro to write out the end of a class definition
\newcommand{\boost@finishclassdefinition}{\boost@startclassdefinition\\\};\\}
%environment to contain a class definition
\newenvironment{class}[1]{\boost@startclassdefinition%
\begingroup%
\def\boost@classname{#1}\def\boost@baseclasses{}\def\boost@templateparams{}\let\boost@startedclassdefinition=\undefined}%
{\boost@finishclassdefinition\endgroup}
%macro to declare a template type param
\newcommand{\templatetypeparam}[2][]{\def\boost@a{#1}\def\boost@b{}\ifx\boost@a\boost@b\def\boost@thisparam{typename #2}\else\def\boost@thisparam{typename #2 = #1}\fi%
  \ifx\boost@templateparams\boost@b\edef\boost@templateparams{\boost@thisparam}\else\edef\boost@oldtemplateparams{\boost@templateparams}\edef\boost@templateparams{\boost@oldtemplateparams ,
\boost@thisparam}\fi%
}
%macro to declare a base class
\newcommand{\baseclass}[2][]{\def\boost@a{#1}\def\boost@b{}\ifx\boost@a\boost@b\def\boost@thisparam{#2}\else\def\boost@thisparam{#1 #2}\fi%
\ifx\boost@baseclasses\boost@b\edef\boost@baseclasses{\boost@thisparam}\else\edef\boost@oldbaseclasses{\boost@baseclasses}\edef\boost@baseclasses{\boost@oldbaseclasses ,
\boost@thisparam}\fi%
}
%macro to declare a typedef
\newcommand{\typedef}[2]{\ifx\boost@classname\undefined\else\boost@startclassdefinition\fi\texttt{typedef #1 #2;\\}}
%make < and > active characters
\catcode`<=13
\catcode`>=13
%so we can redefine them to yield correct text representations
\let<=\textless
\let>=\textgreater
%make _ an 'other' character, so we can use it 
\catcode`\_=12
%redefine $ to be active, so _ is still subscript in math mode
\catcode`$=13
{
\catcode`�=3
\gdef\boost@startmathmode{\catcode`_=8\let$=\boost@endmathmode�}
\gdef\boost@endmathmode{�\catcode`_=12\let$=\boost@startmathmode}
}
\let$=\boost@startmathmode

