473,385 Members | 1,622 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,385 software developers and data experts.

How to extend the STL?

Hi all.

Can anyone give some good pointers or hyperlinks about how to 'extend' the
STL with my own datastructures?

For example, I'd like to add a disjoint set datastructure, but I don't know
how to use (derive from?) the std::iterator in my own class. Also, the stuff
with
allocators isn't entirely clear to me.

Does anybody know of any links which describe this sort of information about
the STL?

Thanks in advance,
Leon.
Jul 19 '05 #1
2 2070
Leon wrote:
Hi all.

Can anyone give some good pointers or hyperlinks about how to 'extend' the
STL with my own datastructures?

For example, I'd like to add a disjoint set datastructure, but I don't know
how to use (derive from?) the std::iterator in my own class. Also, the stuff
with
allocators isn't entirely clear to me.

Does anybody know of any links which describe this sort of information about
the STL?


I can suggest a book: The C++ Standard Library A Tutorial and Reference
by Nicolai M. Josuttis. ISBN: 0-201-37926-0

Section 7.5.2 "User-Defined Iterators" tells you what you want to know
and provides example code.

NR

Jul 19 '05 #2
Hi Leon,

I advice to study a good book on the STL. Personally I appreciate both
The C++ standard Library, A tutorial and reference by Josuttis
and
C++ templates The complete guide by Vandevoorde and Josuttis
very much. The first book will probably already get you there.

Cheers, Cees
Can anyone give some good pointers or hyperlinks about how to 'extend' the
STL with my own datastructures?

Jul 19 '05 #3

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

Similar topics

2
by: sdhyok | last post by:
I think the two script should produce the same results, but not. Why? ---------------- Script #1 ls = ls.extend() print ls -> --------------- Script #2
2
by: Charles Fineman | last post by:
Say i've got a type that appears in a request... say it represents a shipment. I want it to contain things like from and to address elements as well as a sequence of the pieces being shipped. ...
3
by: Alan Little | last post by:
I have a two-column layout, with a background image in the left panel. If the content of the right column is longer than the left, I would like to have the background image repeat all the way down....
1
by: Mike Chamberlain | last post by:
Hi all. I'm trying to extend the Microsoft Enterprise Library Data Access Application Block (http://msdn.microsoft.com/library/en-us/dnpag2/html/daab.asp?frame=true) to work with a Borland...
2
by: Joseph Turian | last post by:
Hi, What is the safest manner to extend search path for modules, minimizing the likelihood of shooting oneself in the foot? The system (which includes scripts and their shared modules) may be...
10
by: Jerzy Karczmarczuk | last post by:
Gurus, before I am tempted to signal this as a bug, perhaps you might convince me that it should be so. If I type l=range(4) l.extend() l gives , what else... On the other hand, try
2
by: Boobie | last post by:
I switched to using this function to create element: ---------------------------------------------------- function elem(name, attrs, style, text) { var e = document.createElement(name); if...
1
by: aaa | last post by:
Im using a datagrid object to view data, Is it possible to extend selected row and show other details at the extended part of the row? If the answer is Y: Is it part of the datagrid's...
4
by: rick | last post by:
hi Is there a DB2 equivalent of Informix.Extend function? or please help me the best way to create one Thanks rick
3
by: jacobstr | last post by:
I've noticed Object.extend used in a few different ways and I'm having trouble distinguishing why certain usages apply to a given situation. On line 804 Ajax.Base is defined as follows: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.