Derived Context::Scope from boost::noncopyable.

Because copying them makes no sense whatsoever.
Added GAFFERTEST_ASSERT macro.

This allows test failures on the C++ side to be reported to Python, rather than just exit as they did before.
Reimplemented Context storage using boost::flat_map.

This gives a pretty decent performance gain over the old CompoundData storage. The synthetic test in IECore.ContextTest.testManyContexts() shows ~40% reduction in runtime for copying a context with 20 entries (a fairly typical size), and ~45% reduction in runtime for a context with 200 entries. A less synthetic test involving an Instancer node with 10000 instances shows ~15% reduction in runtime.
Used anonymous namespace to hide ContextBinding details.

We were using the static keyword before to hide the function, but that did nothing for the structs - anonymous namespace hides them both.
Added _copy argument to Context::get() bindings.

The rationale for this is explained in the comment in ContextBinding.cpp. Although this new feature may eventually have uses of its own, it's primarily needed right now for unit tests for the upcoming Context optimisations.
Fixed Context copy construction doubling in Python bindings.

Because we didn't specify the argument type as a reference, boost::python was copy constructing the context just to make a temporary to pass to the copy constructor.
Added optimised Context copy constructor.

Up till now, every Context held a unique copy of every entry, and copy construction therefore incurred a lot of overhead :

- Memory allocation
- CopyContext machinations in Cortex
- Reference count management

The new copy constructor accepts an Ownership argument that allows the Context to simply reference the data held by the original context rather than making copies. In the Shared mode, the new Context references the same data and owns a reference to it. In Borrowed mode, the new Context references the same data but doesn't even increment the reference count. Using the benchmark in ContextTest.testManyContexts(), Shared mode takes 16% of the runtime of Copied mode, and Borrowed mode takes 14%.

The new constructor isn't used anywhere yet, but the intention is to use Borrowed mode for all the temporary context created during compute() implementations. This is where performance is critical, and also where we can easily meet the constraint that the source context must outlive the new one.
Further optimised Context copy constructor.

The boost::flat_map copy constructor is significantly faster than iterating and inserting elements ourselves, even when we reserve memory upfront and provide what should be the perfect insertion hint. The improvement is more than enough to offset a second iteration over the copy to patch it up with what we want.

The ContextTest.testManyContexts() shows the following reductions in runtime for each mode :

- Copied : 13%
- Shared : 40%
- Borrowed : 54%

Borrowed mode now runs in 66% of the time of Shared mode, and 3% of the time of the master branch.
Switched Context copying to optimised forms where appropriate.

As an example of the kind of benefits this can have, this knocks 30% off the runtime of an Instancer benchmark.

Fixes #427.
Merge pull request #850 from johnhaddon/contextOptimisation

Context copy construction optimisation