473,226 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 software developers and data experts.

stl-list in 2 dimensions

First off, thanks for the help, this group was a great support
for my efforts of learning c++. However, yet again I plan to
throw away what I programmed and re-use a little more of what
stl has to offer:
I would like to create a list of list-nodes of a smaller list
(preferably slist) so that I could iterate through that smaller
list, and iterate through the big list without omitting any
element of the small list. However, the problem is that the
class-name of a list-node isn't standardized. Am I wrong? What
is the usual way to cope with this portability-problem?
Similarily I would like to alter that container's behaviour
so that new list-elements are initialized right into the
list-node without previous initialization and copy-constructor,
i.e. I want to override node-creation so that an object
can get created by a (child inheriting from) list-class
as a node within the list, and not as a stand-alone object.
Here again portability might become a problem. Do I really
need to copy all the source-code from gcc's stl-implementation
right into my own sourcefiles in order to have a portable
program? Doesn't this defy the very purpose of stl?
Can anyone propose a programming-language or library where
my problems can get solved more elegantly?

--
Better send the eMails to netscape.net, as to
evade useless burthening of my provider's /dev/null...

P
Jul 22 '05 #1
4 1692

"Piotr Sawuk" <pi****@unet.univie.ac.at> wrote in message
news:cm*********@gander.coarse.univie.ac.at...
First off, thanks for the help, this group was a great support
for my efforts of learning c++. However, yet again I plan to
throw away what I programmed and re-use a little more of what
stl has to offer:
I would like to create a list of list-nodes of a smaller list
(preferably slist)
slist is non-standard.
so that I could iterate through that smaller
list, and iterate through the big list without omitting any
element of the small list. However, the problem is that the
class-name of a list-node isn't standardized. Am I wrong? What
is the usual way to cope with this portability-problem?
This isn't a portablilty problem, you are trying to pretend that STL lists
have capabilities that they don't.


Similarily I would like to alter that container's behaviour
so that new list-elements are initialized right into the
list-node without previous initialization and copy-constructor,
i.e. I want to override node-creation so that an object
can get created by a (child inheriting from) list-class
as a node within the list, and not as a stand-alone object.
Here again portability might become a problem. Do I really
need to copy all the source-code from gcc's stl-implementation
right into my own sourcefiles in order to have a portable
program? Doesn't this defy the very purpose of stl?

The very purpose is STL is to allow containers of objects of any type in a
non-intrusive way. You seem to want the very opposite. STL is designed to
work with stand alone objects.
Can anyone propose a programming-language or library where
my problems can get solved more elegantly?


The STL is very elegant, you seem to be interested in some very inelegant
micro-optimisations. So I guess the STL isn't for you, but if as you suggest
you already have code that does this, why not stick with that?

john
Jul 22 '05 #2
In article <cm*********@gander.coarse.univie.ac.at>,
pi****@unet.univie.ac.at (Piotr Sawuk) writes:

Can anyone propose a programming-language or library where
my problems can get solved more elegantly?


Meanwhile I have learned that my problem could easily get solved
by a decent templated graph-library, since containers are meant
to be the only owner of their objects. Does anyone know of a
c++ lib where a linked list is implemented with the pointers
between nodes being an array of a size defined through the template,
and iterators being defined through a customizable algorithm
(also part of the template-declaration), preferably open-source?
in other words, does anyone know of a template-library in c++
which implements some more generic and custumizeable list-containers
than the one in the standard-template-library? Or do I need to
write my own "standard" template library?
--
Better send the eMails to netscape.net, as to
evade useless burthening of my provider's /dev/null...

P
Jul 22 '05 #3
"Piotr Sawuk" <pi****@unet.univie.ac.at> wrote...
In article <cm*********@gander.coarse.univie.ac.at>,
pi****@unet.univie.ac.at (Piotr Sawuk) writes:

Can anyone propose a programming-language or library where
my problems can get solved more elegantly?


Meanwhile I have learned that my problem could easily get solved
by a decent templated graph-library, since containers are meant
to be the only owner of their objects. Does anyone know of a
c++ lib where a linked list is implemented with the pointers
between nodes being an array of a size defined through the template,
and iterators being defined through a customizable algorithm
(also part of the template-declaration), preferably open-source?


I don't know of such library (doesn't mean there isn't any). What
I fail to understand is why do you need to have such detailed
implementation specification to successfully use the template.
What does it matter how it is implemented? In most cases that's
not what is important. You need to look at the interface, mostly.

If you need both fast insertions and deletions, and random access
to objects, you could keep objects in 'std::list' and also keep
a vector (or a deque) to 'std::list::iterator' objects that point
to elements in the list.
in other words, does anyone know of a template-library in c++
which implements some more generic and custumizeable list-containers
than the one in the standard-template-library? Or do I need to
write my own "standard" template library?


You don't need to write your own "standard" template library, but you
might want to see if you can, and want to, write your own template
library for containers and algorithms that _you_ need.

The Standard library contains the bare minimum of classes, templates
and functions to get by. If it contained every algorithm or class
imaginable, it would barely fit on all developers' computers taken
together. Besides, at that point you wouldn't need a programmer to
use that library, it would already contain all solutions to all
problems in the world.

V
Jul 22 '05 #4
pi****@unet.univie.ac.at (Piotr Sawuk) wrote in message news:<cn*********@gander.coarse.univie.ac.at>...
In article <cm*********@gander.coarse.univie.ac.at>,
pi****@unet.univie.ac.at (Piotr Sawuk) writes:


than the one in the standard-template-library? Or do I need to
write my own "standard" template library?

If std::list does not suit your needs write your own.
If you want to stick with std::list interface, that is not a
problem too, after all list is not library it's just one
class :)

Greetings, Bane.
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

41
by: Allan Bruce | last post by:
Hi there, I am interested to know if there are any C++ programmers who do not use STL. I have been coding in C++ for a year or so now, although only recently have I started a large(ish)-scale...
2
by: Jean-Baptiste | last post by:
Hi, I am currently porting a C++ project (linux version) under windows. This project uses the STL stuff. When I try to compile and built my project, I get a lot of errors. The main part of them...
2
by: Steve | last post by:
Just wondering if someone can point me to a good, easy to understand online tutorial on STL functions. All the programming manuals I have predate STL, and I would like to learn more about modern...
25
by: Norm Matloff | last post by:
Anyone have an answer--just a guess would do--as to what percentage of programmers who do their primary work in C++ make use of the STL? Norm Matloff
11
by: RR | last post by:
I have Plauger's book on STL and I've found that it's different from the STL I have on a Linux box (libstdc++-2.96-112). In particular, the map::erase(iterator) method I have returns nothing...
0
by: rajd99 | last post by:
Hi, I am getting the following error while compiling with sun C++ 5.5 and using SGI STL. Has anyone run into this. The SGI headers are one at http://www.sgi.com/tech/stl/download.html Thanks, ...
15
by: Herby | last post by:
This is a follow on from my previous thread about clr/safe and STL.NET ...
20
by: Andrew Roberts | last post by:
Any more info on this? Anyone know when it will be released?
6
by: Bart Simpson | last post by:
I am writing a shared object (Dll in Windows) and I am making extensive use of the STL. I am getting lots of warnings like this: ClassA.h(139): warning C4251: 'ClassA::indexarray' : class...
9
by: OuaisBla | last post by:
Although STL container can't support object by reference as a template argument. To make thing worse, allocator can't support stack based allocation. So: std::deque<std::string const &> is...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.