RedWoft

To be or not to be, it is a question.
std::bind2nd()
#include <vector>
#include 
<algorithm>

using std::vector;

// Entrance
int main()
{
    vector
<unsigned> vecUint;
    
const unsigned uiElementNumber = 6U;
    
for (unsigned i = 0U; i < uiElementNumber; ++i)
    {
        vecUint.push_back(i);
    }

    
const unsigned uiRemoveValue = 3U;
    
const unsigned uiReplaceValue = 7U;
    std::replace_if(vecUint.begin(), vecUint.end(), std::bind2nd(std::equal_to
<unsigned>(), uiRemoveValue), uiReplaceValue);
    
return EXIT_SUCCESS;
}

 

posted on 2010-06-22 21:52  RedWoft  阅读(239)  评论(0)    收藏  举报