brian-team/brian2 — pull request #201 by thesamovar (2014-01-24 01:14:24+00:00)
Title: Cpp standalone namespaces

This will fix #187.

I tried to improve namespace handling by using ``std::`` everywhere to avoid doing ``using namespace std``. Unfortunately, this wasn't enough for the ``clock`` issue. The way that ``#include`` works is just to include ``time.h`` inside a ``namespace std {}`` and so global variables still clash. I tried many things to get around this, and it seems there is really no way.

The correct solution is to put all of Brian's global variables into a ``brian::`` namespace of their own.

In the short term, since the most annoying one is ``clock``, I added a hack to ``CPPStandaloneDevice.network_run`` that renames any clock called ``clock`` to ``clock_``. This seems to work but it's not ideal and I imagine there will be other similar issues we'll need to deal with later.

This branch was made from ``dynamic_device`` so shouldn't be merged before that one.

Should we go ahead and merge this hack and say that's OK for the next alpha release and fix the issue for the beta, or should we do it properly now?