编码C ++无标题,最佳实践? [英] Coding C++ without headers, best practices?

查看:121
本文介绍了编码C ++无标题,最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我第一次学习c ++时,我已经在许多其他语言之前编码,这使得标头的前景真的很令人沮丧。到目前为止,我的解决方案编码没有头文件在c ++中远远不是最佳的,限制了我可以在语言中做什么。

When i first learned c++, I had already coded in many other languages prior to it, which made the prospect of headers really depressing. So far, my solution to coding without header files in c++ has been far from optimal, limiting what I can do in the language.

不必编写函数声明两次(头),并且在编译时保持相同的可伸缩性,调试的清晰度和设计的灵活性?

Is there any way to not have to write function declarations twice (headers) and still retain the same scalability in compiling, clarity in debugging and flexibility in design?

所以:
有可能代码C ++没有头吗?如果是,如何?

推荐答案

使用 lzz 。它需要一个单一的文件,并自动创建一个.h和.cpp为所有的声明/定义在正确的地方。

Use lzz. It takes a single file and automatically creates a .h and .cpp for you with all the declarations/definitions in the right place.

lzz真的很强大,

lzz is really very powerful, and handles 99% of full C++ syntax, including templates, specializations etc etc etc.

更新150120:

较新的C ++ '11 / 14语法只能在lzz函数体中使用。

Newer C++ '11/14 syntax can only be used within lzz function bodies.

这篇关于编码C ++无标题,最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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