相关疑难解决方法(0)

std :: copy到std :: cout的std :: cout

我有下一个代码:

#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>

//namespace std
//{

std::ostream& operator << ( std::ostream& out, 
                const std::pair< size_t, size_t >& rhs )
{
    out << rhs.first << ", " << rhs.second;
    return out;
}
//}

int main() 
{

    std::map < size_t, size_t > some_map;

    // fill  some_map with random values
    for ( size_t i = 0; i < 10; ++i )
    {
        some_map[ rand() % 10 ] = rand() % 100;
    }

    // now I want to …
Run Code Online (Sandbox Code Playgroud)

c++ stl namespaces operator-overloading

16
推荐指数
4
解决办法
2万
查看次数

标签 统计

c++ ×1

namespaces ×1

operator-overloading ×1

stl ×1