[mpl] Basic mpl sequence question

Hi, I'm a newbie with mpl and I'm trying to execute some example code from the book "C++ Template Metaprogramming", by Abrahams and Gurtovoy:
From section 5.2, p. 78, Sequences and Algorithms:
I wrote this code: // // mpltest.C // #include<boost/mpl/vector.hpp> using namespace boost; typedef mpl::vector<char,short,int,long,float,double> types; typedef mpl::find<types,long>::type long_pos; int main() { } And I get this compiler error on the mpl::find line: $ g++ mpltest.C -ompltest mpltest.C:10: error: expected initializer before ‘<’ token Can you tell me what I'm doing wrong? Thank you, Mike FYI/IYC: $ g++ --version g++ (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2) Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ____________________________________________________________ Get Free Email with Video Mail & Video Chat! http://www.netzero.net/freeemail?refcd=NZTAGOUT1FREM0210

Michael Robinson wrote:
Hi, <snip> I wrote this code: // // mpltest.C // #include<boost/mpl/vector.hpp>
using namespace boost;
typedef mpl::vector<char,short,int,long,float,double> types;
typedef mpl::find<types,long>::type long_pos;
int main() { }
And I get this compiler error on the mpl::find line: $ g++ mpltest.C -ompltest mpltest.C:10: error: expected initializer before ‘<’ token <snip>
#include <boost/mpl/find.hpp> ? Also check Boost.MPL docs to ensure that's the correct form and everything... - Jeff
participants (2)
-
Jeffrey Hellrung
-
Michael Robinson