Author |
Topic |
|
Jorgos
New Member
2 Posts |
Posted - Dec 21 2016 : 06:47:28 AM
|
Hello, I'm developing in Cpp, and i have following issue. Let say i have following code (It is only a snippet so I don't expect it to compile :) ):
file.h namespace A{ class B{ B(); } } and in file.cpp i have "using namespace A" clause. Now i want to use Create Implementation option. There will be created following method:
file.cpp using namespace A; A::B::B() {}
Adding namespace A:: in this case is not required, and makes code less readable, especially when namespace name is not very short. Is there any option to disable this unnecessary namespace?
|
|
ChrisG
Whole Tomato Software
USA
299 Posts |
Posted - Dec 22 2016 : 07:18:19 AM
|
Hello Jorgos,
Thank you for your feedback. It looks like we have already started tracking this issue. I have added your voice to the case, 20637. |
|
|
pjwhams
Senior Member
25 Posts |
Posted - May 18 2017 : 4:43:39 PM
|
I also have this problem on a daily basis. The problem gets worse when you have something that uses several types from the same namespace. Every time I do 'create implementation' I have to do lots of manual deletion:
// file.h
namespace Company {
namespace Product {
struct ValueType {};
template <T>
class TClass {};
class MyClass
{
public:
TClass<ValueType> getValue(); // nice and short...
};
}} // end namespace
// file.cpp - create implementation
namespace Company {
namespace Product {
// woah.
Company::Product::TClass<Company::Product::ValueType> MyClass::getValue()
{
}
}}
|
Edited by - pjwhams on May 18 2017 4:45:16 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - May 18 2017 : 5:53:41 PM
|
Sorry about this, it is still on our list of things to fix. If you are having a lot of problems like this, you might find it easier to start typing out the class name and member name for the implementation manually. VA should help you insert the correct class name and member name quickly and easily. Also, if the function takes parameters, VA will give you a tooltip offering to insert these when you are typing the implementation.
Not the same, but hopefully something that will help a bit. |
zen is the art of being at one with the two'ness |
|
|
pjwhams
Senior Member
25 Posts |
Posted - May 18 2017 : 6:30:59 PM
|
Thanks for the fast response. Fortunately I use VsVim and judicious use of '4dw' is enough to quickly remove the extraneous namespace. |
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - May 19 2017 : 06:42:29 AM
|
That also works Personally I was never able to think both Vim and IDE at the same time, but I do sometimes miss the power and control of Vim. |
zen is the art of being at one with the two'ness |
|
|
pjwhams
Senior Member
25 Posts |
Posted - May 19 2017 : 07:16:41 AM
|
If I didn't have VisualAssist and VsVim then my productivity would plummet! |
|
|
ChrisG
Whole Tomato Software
USA
299 Posts |
|
pjwhams
Senior Member
25 Posts |
|
Jorgos
New Member
2 Posts |
|
|
Topic |
|