I'm using the HDF5 File System for holding time series information. Rather than writing my own binary search implementation to find particular elements within a particular saved time series, I thought it would be clever if I designed the interface so I could use the Standard Template Library's 'find' iterator. If I can make the STL's 'find' work, then all the other iterators should work just as well, and thus I'll have an easy mechanism to access time series with very little programming involved. Continue reading "C++ Custom Containers and Iterators" »
Wednesday, March 26. 2008
C++ Custom Containers and Iterators
Tuesday, March 25. 2008
Who Needs a SafeD Net?
Bartosz Milewski, a member of the 'D' design team, wrote an article about making the programming language D even safer than it purportedly already is. He called that subset: SafeD. In the process of making D and SafeD look good, the failings of C++ were highlighted in comparison. To his credit, the author was able to list a few good features: performance, low-level access, and powerful abstractions (the latter being slighted at the same time for apparently only being useful in operating systems or large systems design). Continue reading "Who Needs a SafeD Net?" »
Sunday, March 23. 2008
C++ Implementation of Wu Manber's Multi-Pattern Search Algorithm
I'm finding that this algorithm is useful in a number of situations. Out in the real world, it is found in Network Intrusion Scanners, grep engines, as well as text processing. Continue reading "C++ Implementation of Wu Manber's Multi-Pattern..." »
Monday, March 17. 2008
Don't Use Defined Macros, Use Templated Inline Functions Instead
In the olden C days, one would use #define MACRO .... to build an inline macro for computationally quick evaluation of some calculation. When using that method of programming, one needed to remember to parenthesize extensively in order to prevent wierd things from happening when calling the function with an expression.
The modern approach is to use a template for an inline function, which yields all the efficiency of a macro, plus all the predictable behavior and type safety of a regular function (item #2 in the book Effective C++). An example declaration follows:
template<typename T> inline void DoWithMax( const T& a, const T& b ) { f( a > b ? a : b ); }