[英]Are stl algorithms classes with operator() or functions
Recently I've taken C++ quiz and here is question from it: 最近,我参加了C ++测验,这是它的问题:
Select all concepts that are represented in STL by templated classes 选择模板类在STL中表示的所有概念
Obviously 1,2 and 3 are templated classes, but what about algorithms? 显然1,2和3是模板类,但是算法呢? I never thought about it, but algorithms can be templated functions, and also can be templated classes with operator().
我从没想过,但是算法可以是模板化的函数,也可以是带有operator()的模板化类。
Though, I think it does not matter and rather silly question, I'm interested in answer, because I only have number of my mistakes in quiz without knowing where I was right and where wrong. 虽然,我认为这无关紧要,但是愚蠢的问题却使我很感兴趣,因为我在测验中只犯了很多错误,却不知道自己在哪里错了。
tl;dr: Are STL algorithms functions or classes with operator()? tl; dr: STL算法是否具有operator()函数或类?
Thank you. 谢谢。
They're function templates. 它们是功能模板。
See Algorithms library 请参阅算法库
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.