Re: Question about programming techniques



Hi,

> Hi,
>
> ? Hi!
> ?     Every compiler from GNU C to VisualC is shipping with STL container and
> ? algorithm library, which i use for many years. It implement hardly everything
> ? that programmer dreams.
>
> Doesnīt STL stand for Standard Template Library, and can you use Templates
> within Standard C? Where can I find documentation?
>
> ? And its authors spended 15 (!!!) years for the development.
> ? So whay do you really need to invent the weel yourself again ?
>
> I donīt want to reinvent the wheel, definitivly not. I just wanted to
> know, how to wrap different types into a list, without rewriting
> everything. Perhaps you can give me a link to some code where you used
> what you meant.
>
> Dirk

 Yes, it's C++, but you can write absolutely C-style program, without any classes,
but still use all the power of STL. More, it's the best way to learn C++ is to use
C++ libs in your C program. One day you realize that you understand how things are
made and exploit this power :-)
http://www.sj-coop.net/~yotam/stl.html
If it's look hard to you, just try this simplest program:

#include ?string>
#include ?vector>

int main()
{
   vector? string > vec;
   vec.push_back( "Hello " );
   vec.push_back( "world!" );

   for( int i = 0; i ? vec.size(); i++ )
   {
     cout ?? vec[ i ].c_str();
   }
   cout ?? endl;
}



--
          Andrew





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]