大规模使用Meyer的建议喜欢非会员,非朋友的功能? [英] Large scale usage of Meyer's advice to prefer Non-member,non-friend functions?

查看:111
本文介绍了大规模使用Meyer的建议喜欢非会员,非朋友的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直在设计我的类接口是最小的,喜欢命名空间包装成员函数的非成员函数。基本上遵循Scott Meyer在文章非成员函数如何改进封装中的建议。

For some time I've been designing my class interfaces to be minimal, preferring namespace-wrapped non-member functions over member functions. Essentially following Scott Meyer's advice in the article How Non-Member Functions Improve Encapsulation.

我在一些小规模项目中效果不错,但我想知道它是如何工作在一个更大的规模。是否有任何大型的,被广泛认可的开源C ++项目,我可以看看,也许参考强烈遵循这个建议?

I've been doing this with good effect in a few small scale projects, but I'm wondering how well it works on a larger scale. Are there any large, well regarded open-source C++ projects that I can take a look at and perhaps reference where this advice is strongly followed?

更新:感谢所有的输入,但我并不真正感兴趣的意见这么多,以找出它是如何工作在实践中更大规模。尼克的答案在这方面最接近,但我想能够看到代码。任何对实际经验的详细描述(肯定,否定,实际考虑等)也是可以接受的。

Update: Thanks for all the input, but I'm not really interested in opinion so much as finding out how well it works in practice on a larger scale. Nick's answer is closest in this regard, but I'd like to be able to see the code. Any sort of detailed description of practical experiences (positives, negatives, practical considerations, etc) would be acceptable as well.

推荐答案

OpenCV库执行此操作。他们有一个cv :: Mat类,呈现一个3D矩阵(或图像)。然后他们有cv命名空间中的所有其他功能。

OpenCV library does this. They have a cv::Mat class that presents a 3D matrix (or images). Then they have all the other functions in the cv namespace.

OpenCV库庞大,在其领域得到广泛认可。

OpenCV library is huge and is widely regarded in its field.

这篇关于大规模使用Meyer的建议喜欢非会员,非朋友的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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