Simple timed event template class It's a simple timed event template class. It's used in a 3D multiplayer game!
template &lt;class T&gt;
class CTimeEventDecorator : public CBaseDecorator, public CPooledObject&lt;CTimeEventDecorator&lt;T&gt;&gt;
{
public:
    typedef CTimeEvent&lt;T&gt; TTimeEventType;
    typedef std::vector&lt;TTimeEventType&gt; TTimeEventContainerType;

    CTimeEventDecorator(const TTimeEventContainerType&amp; TimeEventContainer, T* pValue = 0)
        : it_start(TimeEventContainer.begin())
        , it_cur(TimeEventContainer.begin())
        , it_next(TimeEventContainer.begin())
        , it_end(TimeEventContainer.end())
        , pData(pValue)
    {
        if (it_start == it_end)
            *pValue = T();
        else
            ++it_next;
    }

    void SetData(T* pValue)
    {
        pData = pValue;
    }

protected:
    CTimeEventDecorator(CTimeEventDecorator&lt;T&gt;&amp; ted, CParticleInstance* pFirstInstance, CParticleInstance* pInstance)
        : it_start(ted.it_start)
        , it_end(ted.it_end)
        , it_cur(ted.it_cur)
        , it_next(ted.it_next)
        , pData((T*)((unsigned char*)ted.pData - (DWORD)pFirstInstance + (DWORD)pInstance))
    {
        if (it_start == it_end)
            *pData = T();
    }

    virtual CBaseDecorator* __Clone(CParticleInstance* pFirstInstance, CParticleInstance* pInstance)
    {
        return new CTimeEventDecorator(*this, pFirstInstance, pInstance);
    }

    virtual void __Execute(const CDecoratorData&amp; d)
    {
        if (it_start == it_end)
            Remove();
        else if (it_cur-&gt;m_fTime &gt; d.fTime)
            *pData = it_cur-&gt;m_Value;
        else
        {
            while (it_next != it_end &amp;&amp; it_next-&gt;m_fTime &lt;= d.fTime)
                ++it_cur, ++it_next;

            if (it_next == it_end)
            {
                *pData = it_cur-&gt;m_Value;
                Remove();
            }
            else
            {
                float length = it_next-&gt;m_fTime - it_cur-&gt;m_fTime;

                *pData = it_cur-&gt;m_Value * (1 - (d.fTime - it_cur-&gt;m_fTime) / length) ;
                *pData += it_next-&gt;m_Value * ((d.fTime - it_cur-&gt;m_fTime) / length);
            }
        }
    }

    typename TTimeEventContainerType::const_iterator it_start;
    typename TTimeEventContainerType::const_iterator it_end;
    typename TTimeEventContainerType::const_iterator it_cur;
    typename TTimeEventContainerType::const_iterator it_next;

    T* pData;
};

What optimizations, refactor I can do?
This answer may come across as harsh, but it is not supposed to be.
Your code looks good, BUT it lacks any comments so it’s quite difficult for other people to understand what it’s purpose is.  I have no doubt that today you know what your code does, but if you are working in a professional capacity in three months time when you have written another several thousand lines you won’t remember.
You have used base classes, but we can’t see them, this means we have even less understanding of the code.
Your coding styles are nice and clean, but you need to decide which one to use for instance you’ve got camel case and underscores in variable names.
It’s possible that things are being done in the base classes that I can’t see, but you seem to be dereferencing pointers without verifying they are not null.  See *pData, which isn’t initialised.
And a really minor thing length could be a const variable.
You say you want to optimise the code.  What problems are there with it?  Have you benchmarked it’s current performance, where is most of the time spent?