using namespace std;
class Static
{
private:
static vector values;
public:
Static ()
{
vector::iterator b = values.begin ();
for (; b != values.end (); b++)
{
cout << *b << endl;
}
}
class VectorInitializer
{
public:
VectorInitializer ()
{
Static::values.push_back (20);
Static::values.push_back (40);
Static::values.push_back (60);
}
};
friend class Static::VectorInitializer;
};
vector
Static::values;
static
Static::VectorInitializer
initalizer; //initializes the vector.
int
main (void)
{
Static
x;
}
Sunday, March 26, 2006
Gopal's static block example
Gopal's example at C++ Static Blocks with better syntax highlighting.
Subscribe to:
Post Comments (Atom)
Ranking and Unranking permutations
I've been a big fan of Skiena's Algorithm Design Manual , I recently found my first edition of the book (although I own the third ed...
-
(Photo from http://content-usa.cricinfo.com/indvaus2008/content/current/player/28114.html) Dravid's dismal form continues in test crick...
-
I've been reading up on Fast Fourier Transform (FFT) from several books on algorithms that I have, TCLR, Tamassia, Sahni, Numerical Rec...
-
The book is almost out there . There is code and selected solutions as well. The book is supposed to be in full colour from what I heard....
2 comments:
This is awesome!
How can I do it?
Well, it is straight forward.
1. Download gvim
2. Enable Syntax Highlighting
3. Export to html
4 cut-copy-paste the html
Open source rocks :-)
Post a Comment