devxlogo

C C++

Statistics Made Easier with STL

rogrammers developing financial, scientific, and numerical analysis applications often need to reinvent the wheel, implementing statistical functions for calculate mean, median, percentiles, and similar statistical data. This solution will show

Revisiting Heterogeneous Containers

ive years ago, I explained how to simulate heterogeneous containers by storing raw pointers to polymorphic objects in an STL container. C++ has come along way since: tuples now allow

Creating Unnamed Functions with the Lambda Library

A lambda expression enables you to define an unnamed function?directly on the call site of an algorithm. Such unnamed functions are chiefly useful in functional programming, generic libraries, and scientific

Automate Resource Management with shared_ptr

td::auto_ptr is the only smart pointer class available in C++98. Alas, since this class is neither assignable nor copy-constructible, creating containers of auto_ptr objects is illegal. This limitation has been

Spruce Up Your Built-in Arrays

++ pundits recommend that you replace built-in arrays with st::vector across the board. Sometimes however, built-in arrays are unavoidable due to their unsurpassed efficiency or because your app must interact