STL classes dummy header

"Martin Sherburn" <[email protected]>
Newsgroups gmane.text.doxygen.devel
Message-ID <[email protected]>
In response to the FAQ, question #15. Why are dependencies via STL classes not shown in the dot graphs?
>> I'm still looking for someone who can provide me with definitions for all (relevant) STL classes.

I've made a header file which covers the main STL classes (vector, deque, list, slist, set, map and pair).

Hopefully it will be usefull to others as well... There are still some classes missing (multiset, multimap, hash_set, hash_map, hash_multiset, hash_multimap). I don't think hash needs to be done since in the documentation it says "The hash<T> template is only defined for template arguments of type char*, const char*, crope, wrope, and the built-in integral types."

If somebody wants to take some time to add the missing classes, what i did was just go to:
http://www.sgi.com/tech/stl/table_of_contents.html 

there is a list of classes there... and if you click on each one there is a description for the class. I've just cut and pasted that into the header file.

One other thing, I didn't put the classes in the std namespace because in my project "using namespace std;" is in my precompiled header file and doxygen misses it. Leaving it as it is will cause problems for people using the stl classes like this "std::vector<MyClass>", rather than "using namespace std; vector<MyClass>". I would suggest if this is ever included in with doxygen that the classes should be in the correct namespace. I'll just have to go and add "using namespace std;" at the top of all my .h files.

SpaceDude.


This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop
stldoxygenhack.h (text/plain, 7.2 KB)
/** \file stldoxygenhack.h
This file contains dummy definitions of the stl container classes so that
dependencies via STL classes are shown in the dot graphs.
*/

// I removed the namespace because doxygen was not picking up "using namespace std;" in my project
//namespace std
//{
	/// STL vector class
	/**
	A vector is a Sequence that supports random access to elements, constant
	time insertion and removal of elements at the end, and linear time insertion
	and removal of elements at the beginning or in the middle. The number of
	elements in a vector may vary dynamically; memory management is automatic.
	Vector is the simplest of the STL container classes, and in many cases the
	most efficient.
	*/
	template<class T> class vector { private: T element; };

	/// STL deque class
	/**
	A deque is very much like a vector: like vector, it is a sequence that supports
	random access to elements, constant time insertion and removal of elements at
	the end of the sequence, and linear time insertion and removal of elements in
	the middle.

	The main way in which deque differs from vector is that deque also supports
	constant time insertion and removal of elements at the beginning of the sequence.
	Additionally, deque does not have any member functions analogous to vector's
	capacity() and reserve(), and does not provide any of the guarantees on iterator
	validity that are associated with those member functions.
	*/
	template<class T> class deque { private: T element; };

	/// STL list class
	/**
	A list is a doubly linked list. That is, it is a Sequence that supports both
	forward and backward traversal, and (amortized) constant time insertion and
	removal of elements at the beginning or the end, or in the middle. Lists have
	the important property that insertion and splicing do not invalidate iterators
	to list elements, and that even removal invalidates only the iterators that
	point to the elements that are removed. The ordering of iterators may be changed
	(that is, list<T>::iterator might have a different predecessor or successor
	after a list operation than it did before), but the iterators themselves will
	not be invalidated or made to point to different elements unless that invalidation
	or mutation is explicit.

	Note that singly linked lists, which only support forward traversal, are also
	sometimes useful. If you do not need backward traversal, then slist may be more
	efficient than list.
	*/
	template<class T> class list { private: T element; };

	/// STL slist class
	/**
	An slist is a singly linked list: a list where each element is linked to the
	next element, but not to the previous element. That is, it is a Sequence
	that supports forward but not backward traversal, and (amortized) constant time
	insertion and removal of elements. Slists, like lists, have the important property
	that insertion and splicing do not invalidate iterators to list elements, and that
	even removal invalidates only the iterators that point to the elements that are
	removed. The ordering of iterators may be changed (that is, slist<T>::iterator
	might have a different predecessor or successor after a list operation than it
	did before), but the iterators themselves will not be invalidated or made to point
	to different elements unless that invalidation or mutation is explicit.

	The main difference between slist and list is that list's iterators are bidirectional
	iterators, while slist's iterators are forward iterators. This means that slist is
	less versatile than list; frequently, however, bidirectional iterators are unnecessary.
	You should usually use slist unless you actually need the extra functionality of list,
	because singly linked lists are smaller and faster than double linked lists.

	Important performance note: like every other Sequence, slist defines the member
	functions insert and erase. Using these member functions carelessly, however,
	can result in disastrously slow programs. The problem is that insert's first
	argument is an iterator pos, and that it inserts the new element(s) before pos.
	This means that insert must find the iterator just before pos; this is a
	constant-time operation for list, since list has bidirectional iterators, but
	for slist it must find that iterator by traversing the list from the beginning
	up to pos. In other words: insert and erase are slow operations anywhere but near
	the beginning of the slist.

	Slist provides the member functions insert_after and erase_after, which are constant
	time operations: you should always use insert_after and erase_after whenever possible.
	If you find that insert_after and erase_after aren't adequate for your needs, and that
	you often need to use insert and erase in the middle of the list, then you should
	probably use list instead of slist.
	*/
	template<class T> class slist { private: T element; };

	/// STL set class
	/**
	Set is a Sorted Associative Container that stores objects of type Key. Set is
	a Simple Associative Container, meaning that its value type, as well as its key
	type, is Key. It is also a Unique Associative Container, meaning that no two
	elements are the same.

	Set and multiset are particularly well suited to the set algorithms includes,
	set_union, set_intersection, set_difference, and set_symmetric_difference.
	The reason for this is twofold. First, the set algorithms require their arguments
	to be sorted ranges, and, since set and multiset are Sorted Associative Containers,
	their elements are always sorted in ascending order. Second, the output range of
	these algorithms is always sorted, and inserting a sorted range into a set or
	multiset is a fast operation: the Unique Sorted Associative Container and Multiple
	Sorted Associative Container requirements guarantee that inserting a range takes
	only linear time if the range is already sorted.

	Set has the important property that inserting a new element into a set does not
	invalidate iterators that point to existing elements. Erasing an element from a
	set also does not invalidate any iterators, except, of course, for iterators that
	actually point to the element that is being erased.
	*/
	template<class Key> class set { private: Key key; };

	/// STL map class
	/**
	Map is a Sorted Associative Container that associates objects of type Key with
	objects of type Data. Map is a Pair Associative Container, meaning that its value
	type is pair<const Key, Data>. It is also a Unique Associative Container, meaning
	that no two elements have the same key.

	Map has the important property that inserting a new element into a map does not
	invalidate iterators that point to existing elements. Erasing an element from a
	map also does not invalidate any iterators, except, of course, for iterators that
	actually point to the element that is being erased.
	*/
	template<class Key, class Data> class map { private: Key key; Data element; };

	/// STL pair class
	/**
	Pair<T1,T2> is a heterogeneous pair: it holds one object of type T1 and one of type
	T2. A pair is much like a Container, in that it "owns" its elements. It is not
	actually a model of Container, though, because it does not support the standard
	methods (such as iterators) for accessing the elements of a Container.

	Functions that need to return two values often return a pair.
	*/
	template<class T1, class T2> class pair { private: T1 element1; T2 element2; };

//}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.