我想在一列中对齐所有C++类成员名称(不要与成员类型混淆).
让我们看一下入口处的例子:
class Foo
{
public:
void method1( );
int method2( );
const Bar * method3( ) const;
protected:
float m_member;
};
Run Code Online (Sandbox Code Playgroud)
这就是我们最终想要拥有的东西:
class Foo
{
public:
void method1( );
int method2( );
const Bar * method3( ) const;
protected:
float m_member;
};
Run Code Online (Sandbox Code Playgroud)
因此,最长的成员类型声明定义了类成员名称将对齐的列.我如何在emacs中执行此类转换?
我正在尝试在 Visual Studio 2008 下编译以下代码:
struct test
{
boost::container::vector<int> v1;
};
test v1, v3;
const test & v2 = v3;
v1 = v2;
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
error C2679: binary '=' : no operator found which requires a right-hand operation of 'const test' (or there is no Acceptable conversion)
could be 'test &test::operator =(尝试匹配参数列表 '(test, const test)' 时测试 &)'
当使用普通 std::vector 而不是 boost::container 等效项时,代码会编译。我正在寻找为什么此代码无法编译以及如何使其编译的答案。