C++ Commons
documentation | browse svn | home page
Overview
The C++ Commons is a general-purpose utility library for the C++ programming language. This is a library of header files, in the same spirit as boost.
Features:
- C functions for string manipulation
- RAII utilities, such as for closing file descriptors and
finally
objects - smart arrays: sized arrays, “managed” (moveable, conditionally scope-destroyed) arrays
pool
: fixed-size object pools- bit manipulation
- bundles of header includes
- C++ support for pthreads, but allowing the user to access the underlying
pthread_t
(a major annoyance of using boost threads was its complete encapsulation) - C++ support for State Threads
- check macros (like assertions but never removed from compilation)
deque
: simpler deque implementation that uses coarse-grained allocation- error handling, such as
die()
, which leverages strerror
- file I/O utilities, such as reading complete files
- function delegates (for use with C functions that take
(void*)(void*)
) - hash functions
- low-level system information from
cpuid
nullptr
: from C++0x- pseudo-random number generators
- region-based memory management
- socket utilities
- portable re-implementations of pthread primitives such as barriers
- time utilities, including timers and simpler interfaces to system clocks
- utilities for streams
- utilities for tamer
- micro-utilities: noncopyable, expander annotations
- x86 architecture-specific tools
Third-party code:
- Howard Hinnant’s C++03-emulated TR1
unique_ptr.hpp
- Yonat’s STL extensions
- pointainer: auto-cleaning STL container of pointers. Many times this is a better alternative than using smart pointers (no overhead, no multi-threading problems).
- pointerator: iterator to T* that behaves like iterator to T. Useful for iterating pointainers and containers of smart pointers.
- stringizer: turns an object into a std::string.
Setup
Requirements:
Like boost, just include these header files in your next C++ project, and you’re ready to go!
Certain parts of the library have extra dependencies. (In particular, these tend to be designed as supplementing the required libraries.)
Code found here generally tries to complement code in the following other handy libraries:
- boost: mountains of goodness
- libstdc++: GNU’s popular STL implementation
- stlport: portable SGI-derived STL implementation that has the extensions like
hash_map
- State Threads: lightweight cooperative threads library that focuses on performance and provides network IO.
Some other general-purpose libraries which I haven’t looked at in-depth:
License
C++ Commons is released under the GNU GPL3.
Copyright 2008 Yang Zhang.
All rights reserved.
Back to assorted.sf.net.