Boost logo

Boost Users :

From: Joshua Schpok (jschpok_at_[hidden])
Date: 2005-10-26 13:46:56


I want to make a 3D array of std::lists:

  boost::multi_array<std::list<CSomething>,3> listbin;

Then I'd like to actually use those lists:

  /// Walk through list at x,y,z
  for(std::list<CSomething>::iterator iter = listbin[x][y][z].begin();
reti != iter[x][y][z].end(); iter++)
  {
      iter->m_foo += 42;
  }

But multi_array is giving me back *const* list iterators, producing the
error:

  error: conversion from `std::_List_const_iterator<CSomething>' to
non-scalar type `std::_List_iterator<CSomething>'
requested

Why is this so? I can trick the compiler by doing a cast like:

  std::list<CSomething>::iterator iter =
((std::list<CSomething>)listbin[x][y][z]).begin();

but this seems to poop out at runtime. Is there a proper way to do this?

Joshua Schpok


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net