I guess you need to define all variations you might need.
Get your guys to see the presentaion from Bjarne Stoustrup and read some of the blogs in C++11. As for templates buy some of the books on the book list and "coincedentially" drop some of them on your desk to start the discussion.
You can even write a few powerpoint presentions, and present them to your team members and build up a culture of research.
I'd have to define extra typedefs for each const and non const type
... which will cause a combinatorial blowup as the number of places where a const fits in the type increases. Explain to your colleagues that the amount of work you're doing increases exponentially because they're fighting the language instead of using it. And yes, use auto when appropriate.
发布评论
评论(4)
一般来说,auto 让您的生活变得更加轻松。
如果您不使用任何深奥的架构(并且没有计划很快这样做),那么答案应该是“尽可能使用自动”。
In general, auto makes your life a lot easier.
If you aren't shipping on any esoteric architectures (and have no plans to do so anytime soon), the answer should be "use auto whenever you can".
我想您需要定义您可能需要的所有变体。
让您的伙伴观看 Bjarne Stoustrup 的演示并阅读一些 C++11 博客。至于模板,购买书单上的一些书,然后“巧合”地将其中一些放在你的桌子上以开始讨论。
您甚至可以编写一些 Powerpoint 演示文稿,并将其呈现给您的团队成员并建立研究文化。
Bjarne Stroustrup:C++11 风格
图书清单:https://stackoverflow.com/tags/c%2b%2b/info
I guess you need to define all variations you might need.
Get your guys to see the presentaion from Bjarne Stoustrup and read some of the blogs in C++11. As for templates buy some of the books on the book list and "coincedentially" drop some of them on your desk to start the discussion.
You can even write a few powerpoint presentions, and present them to your team members and build up a culture of research.
Bjarne Stroustrup: C++11 Style
book list: https://stackoverflow.com/tags/c%2b%2b/info
...这将导致组合爆炸,因为类型中适合 const 的位置数量增加。向你的同事解释,你正在做的工作量成倍增加,因为他们正在与语言作斗争而不是使用它。是的,在适当的时候使用
auto
。... which will cause a combinatorial blowup as the number of places where a
const
fits in the type increases. Explain to your colleagues that the amount of work you're doing increases exponentially because they're fighting the language instead of using it. And yes, useauto
when appropriate.当我创建一个新类时,我做的第一件事就是:
然后我的类的用户可以像这样使用它:
我将它们作为公共 typedef 添加到类中的原因是我讨厌污染全局名称空间。
When I create a new class one of the first things I do is:
Then user's of my class can use it like:
The reason I add them to the class as public typedefs is I hate to pollute the global namespace.