C ++“Named Parameter Idiom” vs. Boost :: Parameter library [英] C++ "Named Parameter Idiom" vs. Boost::Parameter library

查看:204
本文介绍了C ++“Named Parameter Idiom” vs. Boost :: Parameter library的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了命名参数成语和< a href =http://www.boost.org/doc/libs/1_36_0/libs/parameter/doc/html/index.html> Boost :: Parameter library 。每个人有什么优点?有一个很好的理由总是选择一个在另一个,或者在某些情况下,它们中的每一个可能比另一个更好(如果是,什么情况下)?

I've looked at both the Named Parameter Idiom and the Boost::Parameter library. What advantages does each one have over the other? Is there a good reason to always choose one over the other, or might each of them be better than the other in some situations (and if so, what situations)?

推荐答案

实现命名参数习语很容易,几乎和使用Boost :: Parameter一样简单,所以它可以归结为一个要点。

Implementing the Named Parameter Idiom is really easy, almost about as easy as using Boost::Parameter, so it kind of boils down to one main point.

- 你已经有boost依赖吗?如果你不这样做,Boost ::参数不够特殊,不足以添加依赖。

-Do you already have boost dependencies? If you don't, Boost::parameter isn't special enough to merit adding the dependency.

我从来没有在生产代码中看到Boost :: parameter, 100%的时间它是一个自定义实现的命名参数,但这不一定是一件好事。

Personally I've never seen Boost::parameter in production code, 100% of the time its been a custom implementation of Named Parameters, but that's not necessarily a good thing.

这篇关于C ++“Named Parameter Idiom” vs. Boost :: Parameter library的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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