473,763 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1733

"Piotr Sawuk" <pi****@unet.un ivie.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*********@ga nder.coarse.uni vie.ac.at>,
pi****@unet.uni vie.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.un ivie.ac.at> wrote...
In article <cm*********@ga nder.coarse.uni vie.ac.at>,
pi****@unet.uni vie.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::ite rator' 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.uni vie.ac.at (Piotr Sawuk) wrote in message news:<cn******* **@gander.coars e.univie.ac.at> ...
In article <cm*********@ga nder.coarse.uni vie.ac.at>,
pi****@unet.uni vie.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
3006
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 project. I do not use any STL, and I was wondering if there are any others out there that program in C++ without using STL? (Just to see if I am being stupid by not using it) Thanks Allan
2
4797
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 seems to be due to the stl library. Indeed, it seems that the standard libary redefines some structure already defined in xutility. I tryed some tricks without any success.
2
1376
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 C++ since our school doesn't even bother with it.
25
2093
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
2575
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 (void), not "iterator". So, does the latest C++ Standards document (INCITS/ISO/IEC 14882-2003) contain the definitive current standard for STL and all its templates? Is that the recommended document to find the correct STL semantics, or is
0
1867
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, #include <stl/string> class ASPString : public stl::string { public:
15
2032
by: Herby | last post by:
This is a follow on from my previous thread about clr/safe and STL.NET http://groups.google.com/group/microsoft.public.dotnet.languages.vc/browse_thread/thread/0eb9b25a83bc02df/b170a89dbc67c332#b170a89dbc67c332 A more specific problem now is migrating the current MFC serialization onto STL serialization? How best to serilize using STL? STL does not seem to directly support the concept of serialization in
20
1838
by: Andrew Roberts | last post by:
Any more info on this? Anyone know when it will be released?
6
2383
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 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'ClassA' with
9
3890
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 impossible to declare. But, it is also more than impossible to find a workaroung using a custom STL allocator because of the ugly and not object oriented design that was used. Thanks to many STL contributor for this, specially to PJ Plauger where...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.