While there are lots of questions about开发者_运维知识库 coding style, beautifying, and enforcement, I haven't found any example C++ files that are used as a quick reference for style. The file should be one or two pages long and exemplify a given coding standard/style.
For example, the Google C++ Style Guide is a great reference, but I think a one to two page piece of code written in their style pinned to a wall would be more useful in day-to-day use.
Do any of these already exist?
I think Bjarne's JSF AV C++ Coding Standards (doc) is pretty awesome. Although it's a long read, and it goes against stuff you can use safely in everyday applications, etc, it's a good document.
This is because it explains the reasons and gives examples of when it's ok to break the rules and why, therefore it's a veritable tome of knowledge and experience.
Instant c++ level up! :)
I'm not sure if you would consider it 'style' (I would) but Scott Meyer's Effective C++ is a great book for learning good practices in c++. In my opinion if you exercise these practices your 'style' will follow.
Note that it contains lots of examples to re-enforce his lessons. That being said there isn't a large code sample that you can just browse to look at style. Again i think with good practices in place the style will follow.
精彩评论