Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a pure-C alternative to STL containers? [duplicate]

Tags:

c++

c

gcc

stl

ansi

Possible Duplicate:
Container Class / Library for C

One of the primary reasons to use C++ over C is the superbly convenient containers that STL provides. However, if I want to write my code in pure C and not have to write all my containers from scratch, what alternative do I have ?

Some of the ones that I have heard of (but never used) are

  • Glib
  • iMatix Standard Function Library
  • disparate elements from the Linux kernel headers (e.g. list)

Any opinions and/or experiences with containers in pure C (Ansi or otherwise) would be much appreciated.

like image 648
Sandeep Avatar asked May 20 '11 16:05

Sandeep


People also ask

Does C have an STL?

C can't have an "exact equivalent" of STL because C doesn't have templates or classes.

What are the various types of STL containers?

Types of STL Container in C++ In C++, there are generally 3 kinds of STL containers: Sequential Containers. Associative Containers. Unordered Associative Containers.

What are the containers in C?

A container is an object that stores a collection of elements (i.e. other objects). Each of these containers manages the storage space for their elements and provides access to each element through iterators and/or member functions.

What is an STL container C++?

An STL container is a collection of objects of the same type (the elements). Container owns the elements. Creation and destruction is controlled by the container.


1 Answers

I'd recommend GLib solely because it's got a nice set of features and it's relatively mature, stable, portable, and widely used.

like image 124
kqnr Avatar answered Oct 15 '22 07:10

kqnr