由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 也问个STL的问题, 谢谢
相关主题
auto_ptr, algorithm 混用问题,大侠们救我。头疼死了!Remove elements from multiple vectors in C++
A C++ STL question关于不同类型的smart pointer
紧急求助—寻C++ tutorauto 很爽
用STL map的时候怎么自己定义大小比较的关系问个c++的弱问题
don't understand this list (C++ STL)修改map的键值
一个C++的问题Which is next book after "Effective C++"?
C++ vector 一边遍历一边删c++里的函数可不可以是virtual+static
说c++不难的欢迎来看看这个No design patterns are necessary. In any language. - Jan Hudec
相关话题的讨论汇总
话题: std话题: remove话题: int话题: greater话题: 50
进入Programming版参与讨论
1 (共1页)
m*****m
发帖数: 242
1
std::vector items;
Referring to the sample code above, how do you remove all elements from the
items
collections that are greater than 50?
a. items.erase(std::remove_if(items.begin(), items.end(), std::bind2nd(std::
greater(), 50)), items.end());
b. std::remove_if(items.begin(), items.end(), std::greater(50));
c. items.erase(std::remove_if(items.begin(), items.end(), std::bindlst(std::
less_equal(), 50)), items.end());
d. items.remove_if(items.begin(), items.end(), std::bind2
e****d
发帖数: 333
2
你这些题都是哪来的呢?谢了。
t****t
发帖数: 6806
3
选择题还不会查手册...试一试也行啊

the
int

【在 m*****m 的大作中提到】
: std::vector items;
: Referring to the sample code above, how do you remove all elements from the
: items
: collections that are greater than 50?
: a. items.erase(std::remove_if(items.begin(), items.end(), std::bind2nd(std::
: greater(), 50)), items.end());
: b. std::remove_if(items.begin(), items.end(), std::greater(50));
: c. items.erase(std::remove_if(items.begin(), items.end(), std::bindlst(std::
: less_equal(), 50)), items.end());
: d. items.remove_if(items.begin(), items.end(), std::bind2

e****d
发帖数: 333
4
你这些题都是哪来的呢?谢了。
m*****m
发帖数: 242
5
去一个当地的小公司面试, 上来就给发了一些题目做,我当时无意中多拿了一份就带
回来了

【在 e****d 的大作中提到】
: 你这些题都是哪来的呢?谢了。
s******n
发帖数: 21
6
Erase-Remove Idioms

【在 e****d 的大作中提到】
: 你这些题都是哪来的呢?谢了。
e****d
发帖数: 333
7
你还是编程试试吧。a也好像行。

【在 m*****m 的大作中提到】
: 去一个当地的小公司面试, 上来就给发了一些题目做,我当时无意中多拿了一份就带
: 回来了

e****d
发帖数: 333
8
a?

【在 s******n 的大作中提到】
: Erase-Remove Idioms
S*********g
发帖数: 5298
9
it is one item in the book "effective C++ "

【在 e****d 的大作中提到】
: a?
e****d
发帖数: 333
10
Thanks. actually, i read that one some time ago in my spare time.
Looks like more than once is a must.
you mean more effective?

【在 S*********g 的大作中提到】
: it is one item in the book "effective C++ "
相关主题
一个C++的问题Remove elements from multiple vectors in C++
C++ vector 一边遍历一边删关于不同类型的smart pointer
说c++不难的欢迎来看看这个auto 很爽
进入Programming版参与讨论
m*****m
发帖数: 242
11
有点迷惑是因为,题目中说是remove, how do you remove all elements from the
items
collections that are greater than 50?
erase就是eliminate了, 对吧?
选项a是 先remove 再 eliminate 那些大于50的元素
我的意思是remove_if 只是remove, 原来的vector的size不变
erase 是真正的eliminate 那些elements, 改变vector的size。
我不确定原题到底是啥意思?

【在 s******n 的大作中提到】
: Erase-Remove Idioms
e****d
发帖数: 333
12
i guess you mean effective STL right?item 47.

【在 S*********g 的大作中提到】
: it is one item in the book "effective C++ "
S*********g
发帖数: 5298
13
yes, effective STL, not C++

【在 e****d 的大作中提到】
: i guess you mean effective STL right?item 47.
m****o
发帖数: 114
14
brainbench has a lot of stuff like this.

【在 e****d 的大作中提到】
: 你这些题都是哪来的呢?谢了。
g**o
发帖数: 29
15
and you type them?
i saw this exact question in an online test before

【在 m*****m 的大作中提到】
: 去一个当地的小公司面试, 上来就给发了一些题目做,我当时无意中多拿了一份就带
: 回来了

1 (共1页)
进入Programming版参与讨论
相关主题
No design patterns are necessary. In any language. - Jan Hudecdon't understand this list (C++ STL)
STL/vector引用成员变量。一个C++的问题
What is wrong in this array declaration.C++ vector 一边遍历一边删
make 时候遇到 undefined reference 怎么办?说c++不难的欢迎来看看这个
auto_ptr, algorithm 混用问题,大侠们救我。头疼死了!Remove elements from multiple vectors in C++
A C++ STL question关于不同类型的smart pointer
紧急求助—寻C++ tutorauto 很爽
用STL map的时候怎么自己定义大小比较的关系问个c++的弱问题
相关话题的讨论汇总
话题: std话题: remove话题: int话题: greater话题: 50