/// <summary>
        /// Construct a new instance.
        /// </summary>
        /// <param name="phenomeEvaluationScheme">Phenome evaluation scheme.</param>
        /// <param name="initialPoolSize">Initial pool size.</param>
        public PhenomeEvaluatorStackPool(
            IPhenomeEvaluationScheme <TPhenome> phenomeEvaluationScheme,
            int initialPoolSize)
        {
            if (!phenomeEvaluationScheme.EvaluatorsHaveState)
            {
                throw new InvalidOperationException("A stateless evaluation scheme does not require an evaluator pool; just use a single evaluator instance concurrently.");
            }

            _phenomeEvaluationScheme = phenomeEvaluationScheme;

            // Create the stack with the spare capacity; to avoid re-alloc overhead if we require additional capacity.
            _evaluatorStack = new LightweightStack <IPhenomeEvaluator <TPhenome> >(initialPoolSize * 2);

            // Pre-populate with evaluators.
            for (int i = 0; i < initialPoolSize; i++)
            {
                _evaluatorStack.Push(phenomeEvaluationScheme.CreateEvaluator());
            }

            // Enable thread tracking only if the debugger is attached; it adds non-trivial overhead to Enter/Exit.
            _spinLock = new SpinLock(Debugger.IsAttached);
        }