Skip to main content
GameDev.net gamedev.net
🔒 Locked

Java type data structure handling in C++?

Started by GenmaC Apr 17, 2003 at 6:26 AM 2 replies 350+ views
Original Post
GenmaC
GenmaC
I admit it. I''m lazy. I like all the Java data handling stuff, like built in hashmaps, graphs, queues, linked lists, etc etc. But Java just isn''t too hot for developing an actual game. Does anyone know of a library or something I could pick up that emulates the ease of use for this sort of thing in C++? Thanks.
Zoomby
Zoomby
hi,
you can use the STL (Standard Template Library). There are many usefull container classes. Below is a short example of a linked list used as queue. hope it works and helps.

bye
chris


  
#include <list>
#include <iostream.h>
using namespace std;

int main(int argc, char* argv[])
{

//linked list as Queue

list<int> l;


l.push_back(10);
l.push_back(3);


if (!l.empty())
{
//returns 10

cout<<l.front();
l.pop_front();

}



return 0;
}


[edited by - Zoomby on April 17, 2003 7:42:00 AM]
Shannon Barber
Shannon Barber
STL is part of Standard C++, and Boost has a template graph library.



- Magmai Kai Holmlor

"Nobody will listen to a stone no matter how hard you throw it."

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]

The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
GenmaC
GenmaC
Thanks folks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.