Brief introduction to the EXT Library

Although The EXT Library has the "library" in its name, it is rather a collection. Users tends to utilize just a specific parts that suits their immediate needs. This is possible without any additional overhead because the library is distributed with complete source code.

Installation and use details

The installation of the EXT Library is very simple. Unpack the distribution package into any directory; you will probably choose the lib or include sub-directory of your compiler's directory. Then you will need to configure you compiler/environment to look for the included files in parent of this directory (so #include <ext/aaa> command, would find the aaa file if such were present).

Keep in mind that chosen directory should also remain easy to find. To compile some of the functions and classes available in lib, win and res namespaces, you will need to include appropriate .cpp files into compilation. Those files are also to be found there, among header files, with name differing only in extension.


The EXT Library requires reasonably C++03 conformant compiler.

Using the libraries

The EXT Library divides into four sub-libraries:

When installed as described above, the libraries can be included like this:

#include <ext/c++> // C++ sub-library, namespace ext
#include <ext/lib> // Lib sub-library, namespace lib
#include <ext/win> // Win sub-library, namespace win
#include <ext/res> // Res sub-library, namespace res

// ...

Programming with the EXT Library

Controlling macros

Some of the features, for example the for each construct, are implemented as preprocessor macros or depends on their use. Incorporating the EXT Library into products that use such tokens as identifiers could thus be difficult or even imposible. To work around such problems, all EXT Library macros (or certain macros only) can be easily disabled.

You can disable all macros in the library by defining EXT_NO_MACROS before including the <ext/c++> header, as is done in following code.

#include <ext/c++>
#undef EXT_NO_MACROS // not neccessary though

// ...

Note that you can also define other macros as EXT_NO_EACH, EXT_NO_ERROR and further to disable only a particular feature. These are always described on the documentation page of the feature.

Also note that, by default, the EXT Library macros do not comply to the de-facto standard of being upper-case only identifiers. To make them strictly compliant (EACH instead of each, ERROR instead of error, ...), define EXT_FAIR_MACROS before including the <ext/c++> header as in following example.

#include <ext/c++>

// ...

C++ Library

The EXT Library focuses mainly on lightweight extensions to the C++ language itself. By simply putting following line in your file...

#include <ext/c++> allows you to write code like this...

// ...

double input_number = ext::parse <double> (input_string);
// ...

ext::automatic <int, do_this_when_leavin_scope_function> i;
// ...

std::vector <whatever> vec;
for each (std::vector <whatever> ::iterator, i, vec)
    do_this_with_whatever (*i);

// ...

More comprehensive examples can be found in documentation to each feature and also in provided testsuite for the EXT library.

Lib Library

The Lib Library offers few small and lightweight enhancements to the C standard library. Notably the lib::atexit function and the lib::pause function. See index for more.

Win Library

The Win Library is not a complete Windows programming abstraction at all. Other libraries handle this well enough. This one abstracts only some specific functionalities rather than whole Windows API. The most important issues covered are services (win::service), registry access (win::registry), process heap memory allocation (win::process_heap_allocator) and threads (win::thread and win::threadc). See index for more.

Res Library

The Res Library is actually another Win Library but focused on PE file resources. The functionality offered is raw access (win::raw), language-dependent version lookup (win::lang) and easy localizable string access (win::string).


Obviously none of Windows classes and templates are portable.

All C++ Extensions and all other classes and templates are written in standard C++ with some of the GNU G++ extensions used. Thus they should be portable but there may be need for minor corrections.