std :: for_each + break [英] std::for_each + break

查看:90
本文介绍了std :: for_each + break的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想给一些带有谓词的库类的模板方法,

我把它放到那个方法的std :: for_each中。如何用谓词打破

std :: for_each?(例如在特殊的

情况下使用olny,正如我所知)


谢谢

解决方案

11月19日晚上8:12,yurec< Yurij.Zha ... @ materialise.kiev.uawrote:





我想用一些谓词给出库类的模板方法,

我放到那个方法中的std :: for_each。如何用谓词打破

std :: for_each?(例如在特殊的

情况下使用olny,据我所知)


谢谢



也许你会更好地服务于std :: find_if


11月19日下午2:17,alan< almkg ... @ gmail.comwrote:


On No v 19,晚上8:12,yurec< Yurij.Zha ... @ materialise.kiev.uawrote:


Hi

< blockquote class =post_quotes>
我想给一些带有谓词的库类的模板方法,

我把它放到那个方法中的std :: for_each。如何打破

std :: for_each with predicate?(例外情况用于特殊的

情况,如我所知)


谢谢



也许你会更好地服务于std :: find_if



当然, thx


11月19日下午1:12,yurec< Yurij.Zha ... @ materialise.kiev.uawrote:


我想给一些库类的模板方法带一些

谓词,我把它放到std :: for_each那个方法中。怎么回事

break带谓词的std :: for_each?(例外情况是使用

oln y在特殊情况下,据我所知)



你不能。这正是for_each的重点。


-

James Kanze(GABI Software)电子邮件:ja ********* @ gmail.com

Conseils eninformatiqueorientéeobjet/

Beratung in objektorientierter Datenverarbeitung

9placeSémard,78210 St.-Cyr-l' 'école,法国,+ 33(0)1 30 23 00 34


Hi

I wanna give template method of library class with some predicate,
which I put to std::for_each in that method.How to break the
std::for_each with predicate?(exceptions are used olny in exceptional
situations, as i know)

Thanks

解决方案

On Nov 19, 8:12 pm, yurec <Yurij.Zha...@materialise.kiev.uawrote:

Hi

I wanna give template method of library class with some predicate,
which I put to std::for_each in that method.How to break the
std::for_each with predicate?(exceptions are used olny in exceptional
situations, as i know)

Thanks

Perhaps you would be better served by std::find_if


On Nov 19, 2:17 pm, alan <almkg...@gmail.comwrote:

On Nov 19, 8:12 pm, yurec <Yurij.Zha...@materialise.kiev.uawrote:

Hi

I wanna give template method of library class with some predicate,
which I put to std::for_each in that method.How to break the
std::for_each with predicate?(exceptions are used olny in exceptional
situations, as i know)

Thanks


Perhaps you would be better served by std::find_if

For sure, thx


On Nov 19, 1:12 pm, yurec <Yurij.Zha...@materialise.kiev.uawrote:

I wanna give template method of library class with some
predicate, which I put to std::for_each in that method.How to
break the std::for_each with predicate?(exceptions are used
olny in exceptional situations, as i know)

You can''t. That''s precisely the point of for_each.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34


这篇关于std :: for_each + break的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆