C++ comparing bunch of values with a given one
<p>I need to compare one given value with a retrieved values. I do this several times in the code. I am not satisfied with how it looks and I am seeking for a some sort of an util function. Anyone wrote one? </p>

<p>Number of values I am comparing with is known at the compile time.</p>

<p><strong>Update:</strong> I'd like to get rid of containers as I know exact amount of values ( often not more then 3 ) I want to compare with. And it is not so convenient to put items to the container every time.<br>
I don't love <strong>if</strong> neither because it is not obvious as "find".</p>

<pre><code>#include &lt;algorithm&gt;
#include &lt;string&gt;
#include &lt;vector&gt;

std::string getValue1()
{
    return "test";
}

std::string getValue2()
{
    return "the";
}

std::string getValue3()
{
    return "world";
}

int main()
{
    const std::string value = "the";

    // simple if
    if ( value == getValue1() ||
         value == getValue2() ||
         value == getValue3() )
        return 1;

    // using collections like vector, set
    std::vector&lt;std::string&gt; values;
    values.push_back( getValue1() );
    values.push_back( getValue2() );
    values.push_back( getValue3() );
    if ( values.end() != std::find( values.begin(), values.end(), value ) )
        return 1;

    // third option I'd use instead
    //

    return 0;
}
</code></pre>
