Boost logo

Boost :

Subject: [boost] [fusion] Quick start in doc - Something to modify ?
From: Alp Mestan (alp.boost-dev_at_[hidden])
Date: 2008-10-15 04:40:26

Hi Boosters,

I've been reading the Boost.Fusion documentation and I saw an "error" on the
Quick Start page :

The given code is :

#include <boost/fusion/sequence.hpp>
#include <boost/fusion/include/sequence.hpp>

// ...

vector <><int,
char, std::string> stuff(1, 'x', "howdy");
int i = at_c <><0>(stuff);
char ch = at_c <><1>(stuff);
std::string s = at_c

But this way we never get any vector.hpp included. (however I'm on the
svn version... maybe on 1.36 one of the sequence.hpp includes
vector... but I think it is rather the one in the container dir)

And I think such an error makes people let Fusion down, so here is a
"minimal" code that would have a much better effect, IMO, on fusion's
doc readers.

#include <boost/fusion/sequence.hpp> // for boost::fusion::at_c
#include <boost/fusion/include/vector.hpp> // for boost::fusion::vector

#include <iostream>
#include <string>

using namespace boost::fusion;

int main()
        vector<int, char, std::string> stuff(1, 'x', "howdy");
        int i = at_c<0>(stuff);
        char ch = at_c<1>(stuff);
        std::string s = at_c<2>(stuff);
        std::cout << "(" << i << "," << ch << "," << s << ")" << std::endl;
        return 0;

This way, they'd just have to copy, paste, compile & launch to see Fusion in
action, which would make them read the rest of the doc more happily.

Hope it helps.

Alp Mestan

Boost list run by bdawes at, gregod at, cpdaniel at, john at