std::count delimiter issue
<p>I have this C++ snippet that I am trying to understand:</p>

<p>in .hh file: </p>

<pre><code>class A
{
private:
    //recordDelimiter is a '+' character
    // I can do this because char is an integral type!
    static const char recordDelimiter = '+';

    void f()
    {
        ....
        //serializedData is a std:;string
        //Get number of times A::recordDelimiter is found i.e. Number of objects

        // Non-Functional
        int times = (int) std::count (serializedData.begin(), serializedData.end(), A::recordDelimiter);

        // Functional
        const char recDel = A::recordDelimiter;
        int times = (int) std::count (serializedData.begin(), serializedData.end(), recDel);

        // Functional
        int times = (int) std::count (serializedData.begin(), serializedData.end(), '+');

        ....
    }
};
</code></pre>

<p>From std::count reference this is the signature of the function:</p>

<pre><code>template &lt;class InputIterator, class T&gt;
  typename iterator_traits&lt;InputIterator&gt;::difference_type
    count (InputIterator first, InputIterator last, const T&amp; val)
</code></pre>

<p>So I don't see why using <code>A::recordDelimiter</code> instead of <code>'+'</code> is a problem. Compiling gives me  <code>undefined reference to</code>A::recordDelimiter'`</p>

<p>So my question is basically, why is my non-functional code above not functional? and how come doing this :</p>

<pre><code>const char recDel = USerializer::recordDelimiter; 
</code></pre>

<p>and then pass it to std::count works?</p>
