How to use vector in STL


#1

Hello, everyone

How to use std namespace and vector in JUCE?
For example:

#include
using namespace std;

vector array;


#2

well i guess that’s about how you’d do it (or you could do std::vector).

but, why vector? i can understand other types like queue etc… but juce Array makes vector somewhat unnecessary


#3

[quote=“haydxn”]well i guess that’s about how you’d do it (or you could do std::vector).

but, why vector? i can understand other types like queue etc… but juce Array makes vector somewhat unnecessary[/quote]

Unless of course the ‘engine’ of your app is written in standard C++ with NO dependancies and JUCE is only used for I/O and GUI. And you can do wild and crazy things with STL containers. In fact I only use JUCE::Array when JUCE needs one.


#4

#5

Well, the JUCE Array class holds pointers… So surely you just specify that your Array object is going to contain pointers to Array objects… These Array object can then contain pointers to your objects.