In Eclipse CDT, if you type in:
namespace my_ns {
it completes the {
with a closing branch, }
two lines later, and move the cursor to the empty line between.
Is it possible to make Eclipse add
} // namespace my_ns
i.e. also append a trailing comment?
Use content assist to declare the namespace. That means:
namespace
without a trailing space or the name you want to use.Voilà! With Window > Preferences > C/C++ > Code Style > Code Templates > Code > End of namespace declaration you can customize the comment.
Notes:
namespace foo
, then press Ctrl+Space. If you type in an opening brace at that point, you will only get a matching closing brace - not the end of a namespace.namespace - namespace declaration
is the right one.