-2

I tried following example from boost doc, but not sure what header should be included. Had tried the headers in the doc but still reporting: error: 'vector' was not declared in this scope

vector<int, float> v(12, 5.5f);
std::cout << at_c<0>(v) << std::endl;
std::cout << at_c<1>(v) << std::endl;

Btw, I haven't installed boost on my PC yet, just using the online IDE.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Deqing
  • 14,098
  • 15
  • 84
  • 131
  • 3
    you have to specify which `vector` it is supposed to be. I guess it is not the `std::vector`... – 463035818_is_not_an_ai Jun 04 '16 at 14:27
  • 2
    [Minimal, *Complete*, and Verifiable example](http://stackoverflow.com/help/mcve) should be included in your question itself. – MikeCAT Jun 04 '16 at 14:29
  • 1
    @tobi303 It is the vector in boost C++ libraries, I had posted the link to the boost vector document in my question. – Deqing Jun 04 '16 at 14:33
  • @Deqing Looks like you're looking for the [`boost::numeric::ublas::vector`](http://www.boost.org/doc/libs/1_61_0/libs/numeric/ublas/doc/vector.html), it's all pretty well documented in their sample. – πάντα ῥεῖ Jun 04 '16 at 14:35
  • 1
    Thanks @πάνταῥεῖ. I guess it is not. The vector I'm looking for is a container that can store different types of data. Looks like it is called `Fusion sequence container`, but I'm not sure what that means. – Deqing Jun 04 '16 at 14:39
  • 1
    @πάνταῥεῖ: Quit being so rude please. That documentation page (which the OP himself linked to in the question) doesn't make even a _single_ mention of which namespaces to use. To which "documentations" are you referring? It's telling that you've posted and deleted _two_ completely wrong answers already. So why are you up on your high horse with this guy? – Lightness Races in Orbit Jun 04 '16 at 14:42
  • @LightnessRacesinOrbit Well, I learned my lessons. Though I'm not sure that rolling back my edits really helps to improve the question. – πάντα ῥεῖ Jun 04 '16 at 15:33
  • @πάνταῥεῖ: The edit didn't help to improve the question. – Lightness Races in Orbit Jun 04 '16 at 16:55

1 Answers1

2

This documentation is really unclear, but the full name of the type is boost::fusion::vector.

That sample code seems to presume both #includes and a using boost::fusion::vector. The Quick Start for Boost.Fusion makes the same mistake. It seems like whoever wrote the documentation has some bad habits.

Community
  • 1
  • 1
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055