Uncategorized

Writing Generic Container Functions in C++11

Let’s say we want to write function to append one vector to another. It can be done like, template<typename T> void append(Vector<T>& to, const Vector<T>& from) { to.insert(to.end(), from.begin(), from.end()); } One problem with this approach is that we can only use this function with Vector. So what about all other container types? In languages such as C#, we have IEnumerable that simplifies lot of things but with C++ templates are duck typed and it takes bit more to make above function generic for various container types.

How to use Windows network share from domain joined machine on Linux

I’m seeing lot of websites with bit outdated or incomplete instructions. So here are the full steps that works for Ubuntu 14 for mounting Windows network file share on Ubuntu through active directory domain account: First you need to install cifs-utils. Check if you already have it: dpkg -l cifs-utils If not, just install it: sudo apt-get install cifs-utils You can mount Windows shares anywhere but /mnt is generally preferred.