amir9480 / vscode-cpp-helper

vscode extension to create implementation for c++ function prototypes.
https://marketplace.visualstudio.com/items?itemName=amiralizadeh9480.cpp-helper
MIT License
355 stars 31 forks source link

Better friend function support #12

Closed Binary-Song closed 4 years ago

Binary-Song commented 4 years ago

It doesn't seem to generate friend functions correctly. The friend token was not removed and the class scope :: was added. Amazing plugin by the way! Saved me a lot of work.

amir9480 commented 4 years ago

Hello.

I need more information about what you are doing. Please explain with code samples. The header code, the implementation, and the expected output.

Binary-Song commented 4 years ago

Hi.

For expamle, I have a class with a friend << operator declaration.

//my_class.h
#ifndef MY_CLASS_H
#define MY_CLASS_H

#include <iostream>

class MyClass
{
    friend std::ostream &operator<<(std::ostream &strm, MyClass obj);
};

#endif

When I use Create Implementation on operator<<, the output goes like this:

//my_class.cpp
friend std::ostream &MyClass::operator<<(std::ostream &strm, MyClass obj)
{
}

while the expected output should be something like:

//my_class.cpp
std::ostream &operator<<(std::ostream &strm, MyClass obj)
{
}