Hello Paula,
On 03/07/2013 01:14 PM, Paula Agregán Reboredo wrote:
I am Paula, I am student and I am working with Olena.
Great! We are looking for your feedback to improve Olena.
I have a doubt: I
want to use an array of vectors in Olena, which I'm able to define it,
but not to insert the values and display them to see the results. Maybe
I'm defining it wrong:
fun::i2v::array< std::vector<int> >prueba;
Is it well defined? How can I do to insert the values? How can I do to
display them to see the results?
Yes, it is well defined.
fun::i2v::array has a slightly different interface compared to STL
containers.
You can have a look at this page:
http://www.lrde.epita.fr/dload/olena/2.0/doc/milena/devel-refman/d5/d79/a00…
I also wrote a small example included in the bottom of this message.
Thanks for your interest in Olena!
Regards,
Guillaume
-----------------
#include <vector>
#include <mln/fun/i2v/array.hh>
int main(int argc, char *argv[])
{
using namespace mln;
fun::i2v::array<std::vector<int> > fun_arr;
typedef std::vector<int> arr_t;
arr_t arr;
arr.push_back(2);
arr.push_back(3);
// Add data to fun::i2v::array
fun_arr.append(arr);
// Iterate over fun::i2v::array
for (int i = 0; i < fun_arr.size(); ++i)
// Iterate over std::vector
for (arr_t::const_iterator it = fun_arr(i).begin();
it != fun_arr(i).end(); ++it)
{
// Display data.
std::cout << *it << std::endl;
}
}