Topic: Bidimensional Vectors using STL ?
Author: James Kuyper <kuyper@wizard.net>
Date: 1998/04/06 Raw View
Marc Torrens i Arnal wrote:
>
> Hi !
>
> Does anybody know how to use bidimensional vectors using STL ?
Is vector< vector<T> > what you're looking for?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Craig Cavanaugh <ccavanaugh@xolox.com>
Date: 1998/04/08 Raw View
--------------31BC19945C5C6AA05D9592B8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
James Kuyper wrote:
> Marc Torrens i Arnal wrote:
> >
> > Hi !
> >
> > Does anybody know how to use bidimensional vectors using STL ?
>
> Is vector< vector<T> > what you're looking for?
> ---
> [ comp.std.c++ is moderated. To submit articles, try just posting with ]
> [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
> [ --- Please see the FAQ before posting. --- ]
> [ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Hello,
It works but....
Under Visual C++ 5.0 with the SP3 patch it does not using MS standard
templates. (will not compile, problem with resize().. did work before the
patch)
I switched to the SGI template library, but I get memory leaks.
I'm not about to attempt to debug the template library(s). My solution was
to create create my own very simple Vector template.
Does anyone have any solution to the memory leak problem or why the MS
templates won't work?
This is what i've been doing.
typedef <vector<vector<vector<double> > > dVector3D;
typedef <vector<vector<double> > dVector2D;
dVector3D m_Data;
m_Data.resize(50);
for(int i = 0; i < 50; i++)
{
m_Data[i].resize(8);
for(int j = 0; j < 8; j++)
{
m_Data[i][j].resize(2);
m_Data[i][j][0] = 1.0;
m_Data[i][j][1] = 2.0;
}
}
--
Craig Cavanaugh
Xolox Corporation
--------------31BC19945C5C6AA05D9592B8
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
James Kuyper wrote:
<BLOCKQUOTE TYPE=CITE>Marc Torrens i Arnal wrote:
<BR>>
<BR>> Hi !
<BR>>
<BR>> Does anybody know how to use bidimensional vectors using STL ?
<P>Is vector< vector<T> > what you're looking for?
<BR>---
<BR>[ comp.std.c++ is moderated. To submit articles, try just posting
with ]
<BR>[ your news-reader. If that fails, use <A HREF="mailto:std-c++@ncar.ucar.edu">mailto:std-c++@ncar.ucar.edu</A>
]
<BR>[
--- Please see the FAQ before posting. ---
]
<BR>[ FAQ: <A HREF="http://reality.sgi.com/austern_mti/std-c++/faq.html">http://reality.sgi.com/austern_mti/std-c++/faq.html</A>
]</BLOCKQUOTE>
Hello,
<P> It works but....
<P>Under Visual C++ 5.0 with the SP3 patch it does not using MS standard
templates. (will not compile, problem with resize().. did work before the
patch)
<BR>I switched to the SGI template library, but I get memory leaks.
<P>I'm not about to attempt to debug the template library(s). My
solution was to create create my own very simple Vector template.
<P>Does anyone have any solution to the memory leak problem or why the
MS templates won't work?
<P>This is what i've been doing.
<P>typedef <vector<vector<vector<double> > > dVector3D;
<BR>typedef <vector<vector<double> > dVector2D;
<P>dVector3D m_Data;
<P>m_Data.resize(50);
<P>for(int i = 0; i < 50; i++)
<BR>{
<BR> m_Data[i].resize(8);
<BR> for(int j = 0; j < 8; j++)
<BR> {
<BR> m_Data[i][j].resize(2);
<P> m_Data[i][j][0] = 1.0;
<BR> m_Data[i][j][1] = 2.0;
<BR> }
<BR>}
<BR>
<PRE>--
Craig Cavanaugh
Xolox Corporation</PRE>
</HTML>
--------------31BC19945C5C6AA05D9592B8--
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: martelli@cadlab.it (Alex Martelli)
Date: 1998/04/09 Raw View
Craig Cavanaugh <ccavanaugh@xolox.com> writes:
...
>Under Visual C++ 5.0 with the SP3 patch it does not using MS standard
>templates. (will not compile, problem with resize().. did work before the
...
>Does anyone have any solution to the memory leak problem or why the MS
>templates won't work?
>This is what i've been doing.
>typedef <vector<vector<vector<double> > > dVector3D;
>typedef <vector<vector<double> > dVector2D;
[rest snipped]
With an "#include <vector>" and a "using namespace std;", this works
just fine for me with VC++5.0 SP3 -- as long, of course, as I remove
the extraneous '<' between typedef and vector in these lines.
Alex
--
____ Alex Martelli, Bologna, Italia -- email: alex@magenta.com
\SM/___ http://magenta.com/~alex
\/\bi/ You never know what is enough unless you know what
\/ is more than enough.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Marc Torrens i Arnal <Marc.Torrens@epfl.ch>
Date: 1998/03/31 Raw View
Hi !
Does anybody know how to use bidimensional vectors using STL ?
Thanks,
Marc.
--=20
------------------------------------------------
Marc Torrens i Arnal
LIA-EPFL, Artificial Intelligence Laboratory
Lausanne, Switzerland
T=E9l : ++41 (0)21 - 693 66 79
Fax : ++41 (0)21 - 693 52 25
E-mail : Marc.Torrens@epfl.ch
www : http://liawww.epfl.ch/~torrens
------------------------------------------------
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]