From: <den...@us...> - 2009-07-06 14:08:11
|
Revision: 6 http://stdair.svn.sourceforge.net/stdair/?rev=6&view=rev Author: denis_arnaud Date: 2009-07-06 14:08:06 +0000 (Mon, 06 Jul 2009) Log Message: ----------- [Tests] Added the MPL book sub-directory. Modified Paths: -------------- trunk/stdair/configure.ac trunk/stdair/test/mpl/Makefile.am trunk/stdair/test/mpl/mpl.cpp Added Paths: ----------- trunk/stdair/test/mpl/book/ trunk/stdair/test/mpl/book/Makefile.am trunk/stdair/test/mpl/book/ch_01.cpp trunk/stdair/test/mpl/book/contrib/ trunk/stdair/test/mpl/book/contrib/binary.hpp Modified: trunk/stdair/configure.ac =================================================================== --- trunk/stdair/configure.ac 2009-07-06 12:31:33 UTC (rev 5) +++ trunk/stdair/configure.ac 2009-07-06 14:08:06 UTC (rev 6) @@ -193,7 +193,8 @@ stdair/config/Makefile test/Makefile test/com/Makefile - test/mpl/Makefile) + test/mpl/Makefile + test/mpl/book/Makefile) AC_OUTPUT echo " Modified: trunk/stdair/test/mpl/Makefile.am =================================================================== --- trunk/stdair/test/mpl/Makefile.am 2009-07-06 12:31:33 UTC (rev 5) +++ trunk/stdair/test/mpl/Makefile.am 2009-07-06 14:08:06 UTC (rev 6) @@ -3,6 +3,8 @@ MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = book + check_PROGRAMS = mpl mpl_SOURCES = mpl.cpp Property changes on: trunk/stdair/test/mpl/book ___________________________________________________________________ Added: svn:ignore + .deps .libs Makefile.in Makefile ch?? Added: trunk/stdair/test/mpl/book/Makefile.am =================================================================== --- trunk/stdair/test/mpl/book/Makefile.am (rev 0) +++ trunk/stdair/test/mpl/book/Makefile.am 2009-07-06 14:08:06 UTC (rev 6) @@ -0,0 +1,12 @@ +## command sub-directory +include $(top_srcdir)/Makefile.common + +MAINTAINERCLEANFILES = Makefile.in + +check_PROGRAMS = ch01 + +ch01_SOURCES = ch_01.cpp +ch01_CXXFLAGS = $(BOOST_CFLAGS) +ch01_LDADD = $(BOOST_LIB) + +EXTRA_DIST = Added: trunk/stdair/test/mpl/book/ch_01.cpp =================================================================== --- trunk/stdair/test/mpl/book/ch_01.cpp (rev 0) +++ trunk/stdair/test/mpl/book/ch_01.cpp 2009-07-06 14:08:06 UTC (rev 6) @@ -0,0 +1,13 @@ +// STL +#include <iostream> +// Book on Boost MPL +#include "contrib/binary.hpp" + +// ///////////// M A I N ////////////// +int main (int argc, char* argv[]) { + + const long l42 = binary<101010>::value; + std::cout << "The 101010 binary number is equal to: " << l42 << std::endl; + + return 0; +} Added: trunk/stdair/test/mpl/book/contrib/binary.hpp =================================================================== --- trunk/stdair/test/mpl/book/contrib/binary.hpp (rev 0) +++ trunk/stdair/test/mpl/book/contrib/binary.hpp 2009-07-06 14:08:06 UTC (rev 6) @@ -0,0 +1,13 @@ +// Boost MPL +#include <boost/mpl/long.hpp> +#include <boost/mpl/alias.hpp> + +template< long n > struct binary + : mpl::long_< ( binary< n / 10 >::value << 1 ) + n % 10 > +{ +}; + +template<> struct binary<0> + : mpl::long_<0> +{ +}; Modified: trunk/stdair/test/mpl/mpl.cpp =================================================================== --- trunk/stdair/test/mpl/mpl.cpp 2009-07-06 12:31:33 UTC (rev 5) +++ trunk/stdair/test/mpl/mpl.cpp 2009-07-06 14:08:06 UTC (rev 6) @@ -1,4 +1,3 @@ -// Marginal Revenue Transformation (method from T. Fiig & K. Isler) // STL #include <iostream> #include <sstream> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |