If we talk about standard C++ SQL (C++03, at least) looking for a data structure to simulate a list with logarithmic lookup, the question will appear to be contradictory to begin with.
If we are looking for a data structure whose access pattern is different from that of the underlying storage mechanism - Boost MultiIndex is an option worth spending at.
Showing posts with label STL. Show all posts
Showing posts with label STL. Show all posts
Thursday, January 24, 2008
Wednesday, January 23, 2008
C++ - atexit implementation
More than one occasion - when a program exits - we may want to do some cleanup operations and notify other processes ( this becomes extremely important in the case of child-parent processes).
C/C++ does have a function called atexit() that does that.
A sample code fragment to use the same is as follows.
Sample output:
C/C++ does have a function called atexit() that does that.
A sample code fragment to use the same is as follows.
#include <cstdlib>
#include <iostream>
using namespace std;
void do1()
{
std::cout << "do1 implementation\n";
}
void do2()
{
std::cout << "do2 implementation\n";
}
int main()
{
atexit(do1);
atexit(do2);
exit(EXIT_SUCCESS);
}
Sample output:
$ g++ -Wall -Werror testexit.cpp
[noname@localhost test]$ ./a.out
do2 implementation
do1 implementation
Subscribe to:
Posts (Atom)