This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
C Analog To STL
Is there something like STL for C.
You can have a look at the glib, which provides lots of interesting features
well there is the C library of course :) but I do not see the use of templates for C
There's not really anything quite like the STL; but there are a lot of libraries. glib has been mentioned, but usually it's not always useable together with whatever libraries you are using for actually achieving what you want to do.
Related
This question already has answers here:
Is there a C++ equivalent to getcwd?
(8 answers)
Closed 2 years ago.
I'am familiar that getcwd() function is available in c to get current working directory.Is there a std function in cpp for the same?
Yes.
C++17 has std::filesystem::current_path.
On a POSIX system, you can also just keep using getcwd(). getcwd() is not actually part of C. Even it were, you could still keep using it, as the C Standard Library is available in C++; however, you've probably heard that it is preferable to use the C++ Standard Library where possible, and that's largely true.
Use current_path() method in boost::filesystem or std::filesystem::current_path() in c++17
This question already has answers here:
Is there any cross-platform threading library in C++?
(12 answers)
Closed 8 years ago.
C++11's threading library is wonderful looking. It's small, simple, standard, and portable. Unfortunately, I'm locked to Visual Studio 2010 which obviously doesn't have that available to it.
My questions are, what multi-threading libraries are available that provide a similar level of functionality, while being portable and reliable? Is it possible (physically and legally) to obtain the corresponding <thread> library to use in VS2010? Are there disadvantages to using a separate library (maybe not as actively maintained since C++11 fills that role, etc)?
First, take a look on wikipedia list of C++ multi-threading libraries. Some very well documented library can by POCO C++. However, you can also see related question Is there any cross-platform threading library in C++?.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Do I need to protect read access to an STL container in a multithreading environment?
I am using the C++ standard library which comes with (Linux) GCC or (Windows) VC.
Can anyone please say clearly whether or not this library is thread safe?
"Thread safe" is not a clearly-defined boolean property of a library. Some things can be done concurrently and others cannot.
Almost certainly if you were to ask a more detailed question specifying what it is you want to do, the answer would be "no, it is not thread-safe". But only almost.
If by "thread-safe" you mean something like the difference between Vector and ArrayList in Java, then C++ standard containers are non-thread-safe.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Container Class / Library for C
I expect I'd be forced to use vectors, lists and sets for my C program. Should I invent those entities from scratch, or there is some kind of standard library for C as STL is for C++ ?
C doesn't have templates, so it might be difficult to implement those C++ collections in a generic way. I'm not aware of any libraries that implement those features in C.
If I were faced with such a situation, my first thought would be to isolate the parts
of my program that would benefit from C++ features, write them in C++, then provide
an extern "C" interface to those modules so they could be called from the pure C
parts of the program. Is that an option for you?
You can look at APR, or GLib. Those are widely used portable C libraries with everything you need not to reinvent the wheel each time.
There is a standard c library, but it does not have any support for built-in container types such as the ones you list.
This question already has answers here:
Closed 13 years ago.
Possible Duplicates:
Hashtable in C++?
can anybody offer a simple hash_map example in C++?
Does the STL contain an implementation of a hashtable?
If so, can you provide a brief example of how to use it?
Current standard implementation doesn't, STL::TR1 does, see Unordered Map.
Most modern compilers have a TR1 implementation, if that fails, you may always use the Boost TR1 implementation.
MSVC has it for VS2008 via service pack 1
GCC has it shipped with 4.x, but you can make it work with 3.4.x too AFAIR
Usage is almost the same as with a std::map.
While not officially part of the STL standard, hash_map and hash_set are commonly used to improve searching times......
http://msdn.microsoft.com/en-us/library/0d462wfh%28VS.80%29.aspx
So, long story short--no .
A quick google came up with this description of hash_map.