hi-
where would someone find things like lists, sets, map classes like a
hash map or tree map. not specifically those but in general is there
a book section that deals with it? in java you can use the interface
to these without having to know all of the implementation details.
is there an interface to a library with these kind of methods in c++?
i knew a little c++ from 2 really basic introductory courses.
however, each time we wanted this functionality we had to program
it. an example where this would be cool is if i wanted a data structure
that TCL didn't have. i could extend TCL with C++.
thanks for letting me know what people use.
jim 16 5078
i just found a listing point to the STL.
thanks,
later
3rdshiftcoder wrote:
hi-
where would someone find things like lists, sets, map classes like a
hash map or tree map. not specifically those but in general is there
a book section that deals with it?
This is referred to as the "standard template library" (STL) and is a
normative part of the C++ standard. Not only does the STL encompass
containers like you have mentioned but also algorithms like sort or find.
There are many books that discuss these.
The "reference" I used often but it is a little dated is the SGI web
site on the STL (I have not looked at them for a while myself - maybe it
is updated). http://www.sgi.com/tech/stl/
SGI has implemented some containers that are not part of the standard so
you need to be a little careful.
The ones you will use almost all the time in modern c++ code are:
basic_string
vector
list
map
sort
The ones I know are not part of the current standard are:
hash_map
rope
.... probably others.
The SGI examples are missing a few namespace specifiers. Usually a
using namespace std; somewhere in the example fixes those probs.
Hi Gianni -
that is a very cool link :-)
i think this is worth checking out !
the first 2 semesters of coding at school were very basic.
this is definitely some of the stuff that is missing.
thanks very much,
jim
"Gianni Mariani" <gi*******@mari ani.wswrote in message
news:46******** *************** @per-qv1-newsreader-01.iinet.net.au ...
3rdshiftcoder wrote:
>hi-
where would someone find things like lists, sets, map classes like a hash map or tree map. not specifically those but in general is there a book section that deals with it?
This is referred to as the "standard template library" (STL) and is a
normative part of the C++ standard. Not only does the STL encompass
containers like you have mentioned but also algorithms like sort or find.
There are many books that discuss these.
The "reference" I used often but it is a little dated is the SGI web site
on the STL (I have not looked at them for a while myself - maybe it is
updated). http://www.sgi.com/tech/stl/
SGI has implemented some containers that are not part of the standard so
you need to be a little careful.
The ones you will use almost all the time in modern c++ code are:
basic_string
vector
list
map
sort
The ones I know are not part of the current standard are:
hash_map
rope
... probably others.
The SGI examples are missing a few namespace specifiers. Usually a using
namespace std; somewhere in the example fixes those probs.
On Tue, 19 Jun 2007 00:36:32 -0400, "3rdshiftco der" wrote:
>where would someone find things like lists, sets, map classes like a hash map or tree map. not specifically those but in general is there a book section that deals with it? in java you can use the interface to these without having to know all of the implementation details. is there an interface to a library with these kind of methods in c++?
Actually, there is no equivalent for Java collections in Standard C++.
Java collections work only with objects but not with values, Standard
C++ collections (a.k.a. STL) work only with values but not with
objects.
--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
On 2007-06-19 07:27, 3rdshiftcoder wrote:
"Gianni Mariani" <gi*******@mari ani.wswrote in message
news:46******** *************** @per-qv1-newsreader-01.iinet.net.au ...
>3rdshiftcode r wrote:
>>hi-
where would someone find things like lists, sets, map classes like a hash map or tree map. not specifically those but in general is there a book section that deals with it?
This is referred to as the "standard template library" (STL) and is a normative part of the C++ standard. Not only does the STL encompass containers like you have mentioned but also algorithms like sort or find.
There are many books that discuss these.
The "reference" I used often but it is a little dated is the SGI web site on the STL (I have not looked at them for a while myself - maybe it is updated). http://www.sgi.com/tech/stl/
SGI has implemented some containers that are not part of the standard so you need to be a little careful.
The ones you will use almost all the time in modern c++ code are:
basic_string vector list map sort
The ones I know are not part of the current standard are:
hash_map rope
... probably others.
The SGI examples are missing a few namespace specifiers. Usually a using namespace std; somewhere in the example fixes those probs.
Hi Gianni -
that is a very cool link :-)
i think this is worth checking out !
the first 2 semesters of coding at school were very basic.
this is definitely some of the stuff that is missing.
Please, try not to top-post (fixed here), it makes it much harder to
read your posts and there are people who will not reply to people who
top-post which means you might miss out on some valuable information.
Another link to check out would be the following: www.cppreference.com,
which I believe is fully standards compliant and quite easy to navigate.
--
Erik Wikström
On Jun 19, 1:37 am, rpbg...@yahoo.c om (Roland Pibinger) wrote:
On Tue, 19 Jun 2007 00:36:32 -0400, "3rdshiftco der" wrote:
where would someone find things like lists, sets, map classes like a
hash map or tree map. not specifically those but in general is there
a book section that deals with it? in java you can use the interface
to these without having to know all of the implementation details.
is there an interface to a library with these kind of methods in c++?
Actually, there is no equivalent for Java collections in Standard C++.
Java collections work only with objects but not with values, Standard
C++ collections (a.k.a. STL) work only with values but not with
objects.
Having worked with both, I can kind of see what you mean. However, I
fundamentally disagree
with what you imply. It is true that c++ standard containers are by
value but there is no
restriction whatsoever regarding the type of that value. The value
can be a class in which
case, the objects themselves will be copied, potentially many times.
You can specify that
the containers carry pointers to objects. Finally, you can specify
that the containers can
carry shared pointers to objects which provide the same basic
advantages as Java's school marm
garbage collection.
regards,
Jon Trauntvein
On Jun 19, 3:37 am, rpbg...@yahoo.c om (Roland Pibinger) wrote:
Actually, there is no equivalent for Java collections in Standard C++.
Java collections work only with objects but not with values, Standard
C++ collections (a.k.a. STL) work only with values but not with
objects.
In a frameowrk like COM, where everything already inherits from
IUnknown, tt is easy to use a shared pointer, and have something that
can store references to any object.
Even with such a framework, I agree that it is fairly difficult to
emulate Java Collections using C++. However, I have found the model
useful in some cases, when I want to model a sequence or collection in
an abstract interface.
In other words you have something like:
tempalte <class Tstruct Collection{
Iterator<Tbegin ()=0;
Iterator<Tend() =0;
ConstIterator<T begin()const=0;
ConstIterator<T end()const=0;
bool empty()const=0;
std::size_t size()const=0;
//plus all the requred typedefs
};
I have actually gotten this to work for read-only containers that
return const InputIterators. But going further (e.g. Forward
iterators, modifyable containers) was a lot of work for little
payoff.
On Jun 19, 9:37 am, rpbg...@yahoo.c om (Roland Pibinger) wrote:
On Tue, 19 Jun 2007 00:36:32 -0400, "3rdshiftco der" wrote:
where would someone find things like lists, sets, map classes like a
hash map or tree map. not specifically those but in general is there
a book section that deals with it? in java you can use the interface
to these without having to know all of the implementation details.
is there an interface to a library with these kind of methods in c++?
Actually, there is no equivalent for Java collections in Standard C++.
Java collections work only with objects but not with values, Standard
C++ collections (a.k.a. STL) work only with values but not with
objects.
That's to be expected, since C++ as a language works only with
values, where as Java works mainly with pointers. In this
respect, each of the libraries "fits in" with the language; a
C++ library which worked with pointers would be
counter-intuitive.
On the the other hand, the interfaces of the collections are
significantly different---the C++ two iterator idiom makes most
things significantly more verbose, is much more awkward to work
with, and much less flexible. (Of course, the Java iterator
combines access and increment, which has a few drawbacks as
well.)
--
James Kanze (GABI Software, from CAI) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
On Tue, 19 Jun 2007 11:16:27 -0000, JH Trauntvein wrote:
>Having worked with both, I can kind of see what you mean. However, I fundamentall y disagree with what you imply. It is true that c++ standard containers are by value but there is no restriction whatsoever regarding the type of that value. The value can be a class in which case, the objects themselves will be copied, potentially many times. You can specify that the containers carry pointers to objects.
You are right that the container value type can be a value or a
pointer to an object. But nevertheless STL is designed with 'value
semantics' in mind, e.g.
std::vector<T*v ;
std::sort (v.begin(), v.end());
compiles but gives false results.
>Finally, you can specify that the containers can carry shared pointers to objects
pointers in C/C++ are shared by default ;-)
--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mark |
last post by:
I've been getting odd compile errors when trying to sort while using
generics.
I have the following code:
static final List<Class> levelList;
static {
Vector<Class> v = new Vector<Class>();
v.add(myClass1.class);
|
by: Egghead |
last post by:
Hi,
Does anyone know if there is any C#'s class equivalent to java.utl.Vector?
I think the System.Collections.ArrayList is not the same:
In java:
for(int i = 0; i<myVector.length;i++)
{
mySecondVector = (Vector)MyVector// <--- in C#, it does not allow me
to add an ArrayList inside an ArrayList, may be I miss something :(
for(int j = 0;...
|
by: comp.lang.php |
last post by:
I looked up System.getProperties, but to be honest, I have no clue how
to use it in light of what I can do in PHP, which is this:
<?php echo $_SERVER . ' ' . $_SERVER;
?>
it would be very nice to find the JSP equivalent of <? phpinfo(); ?>
(anyone know who knows both PHP and JSP?) but until then, what on earth
do I do?
|
by: Jobs |
last post by:
Download the JAVA , .NET and SQL Server interview with answers
Download the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
|
by: coosa |
last post by:
Dear all,
I'm familiar with the Set Class in C++ and Java; however, i have been
searching in C# for a similar container as in c++ or collection as in
java, but couldn't find one.
Could some one tell me about the the Set implementation inside .NET?
Best regards
| |
by: Maury |
last post by:
Do someone knows if exists a .Net equivalent
of ConcurrentLinkedQueue<Tfound in Java?
this class in java provides a queue which is threadsafe...
thanks
|
by: Ian |
last post by:
I would like to port my class library written in standard C++ with STL to
C++/CLI. Several of my classes inherit from std::vector or std::deque.
From what I can see, dot.net does not offer equivalent classes. Is this
really the case or have I missed an entire section of the dot.net
documentation? One could argue ArrayList offers a poor...
|
by: raagadeepthi |
last post by:
Getting below error when iam trying to sort the values:
Oct 29 04:33:52 WARN cb.DefaultController - Cannot forward after response has been committed
java.lang.IllegalStateException: Cannot forward after response has been committed
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:375)
at...
|
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |