Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename TKey, typename TValue>
- struct resetter : public std::unary_function<std::pair<TKey, TValue> > {
- TValue const value;
- public resetter(value const& v) : value(v) { }
- public void operator ()(std::pair<TKey, TValue>& v) {
- v.second = value;
- }
- };
- for_each(map.begin(), map.end(), resetter<Key, Value>(value));
- map <int,string> myMap;
- for( int k=0;k<1000;k++)
- myMap.insert(pair<int,string>(k,string("")));
- map<string,int> m;
- insert( m )( "Bar", 1 )( "Foo", 2 );
- map<int,int> next = map_list_of(1,2)(2,3)(3,4)(4,5)(5,6);
- pair<int,string> init( 0,string(""));
- multimap <int,string> myMap = repeat(1000,init);
- map <int,string> myMap;
- struct nextkey
- {
- int start;
- nextkey( s ) : start( s ) {}
- pair<int,string> operator () ()
- {
- return pair<int,string>(start++,string(""));
- }
- };
- myMap = repeat_fun(1000,nextkey(0));
- map <int,string> myMap;
- for( int k=0;k<1000;k++)
- myMap.insert(pair<int,string>(k,string("")));
- #include <boost/range/adaptor/map.hpp>
- auto my_values = boost::adaptors::values(my_map);
- std::fill(my_values.begin(), my_values.end(), 123);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement