ReSharper 2021.1 Help

C++ - Spaces

In declarations

Before ptr in declaration of variable

Property names:

[resharper_]cpp_space_before_ptr_in_data_member, [resharper_]space_before_ptr_in_data_member

Possible values:

true | false

Examples:

true
int ** data;
false
int** data;

After ptr in declaration of variable

Property names:

[resharper_]cpp_space_after_ptr_in_data_member, [resharper_]space_after_ptr_in_data_member

Possible values:

true | false

Examples:

true
int** data;
false
int**data;

Before ptr in declaration of multiple variables

Property names:

[resharper_]cpp_space_before_ptr_in_data_members, [resharper_]space_before_ptr_in_data_members

Possible values:

true | false

Examples:

true
int **data, *data2, &data3 = *data2;
false
int**data,*data2, &data3 = *data2;

After ptr in declaration of multiple variables

Property names:

[resharper_]cpp_space_after_ptr_in_data_members, [resharper_]space_after_ptr_in_data_members

Possible values:

true | false

Examples:

true
int ** data, * data2, &data3 = *data2;
false
int **data, *data2, &data3 = *data2;

Before ptr in return type of function

Property names:

[resharper_]cpp_space_before_ptr_in_method, [resharper_]space_before_ptr_in_method

Possible values:

true | false

Examples:

true
int ** foo(int a, int b);
false
int** foo(int a, int b);

After ptr in return type of function

Property names:

[resharper_]cpp_space_after_ptr_in_method, [resharper_]space_after_ptr_in_method

Possible values:

true | false

Examples:

true
int** foo(int a, int b);
false
int**foo(int a, int b);

Before ptr in abstract declaration

Property names:

[resharper_]cpp_space_before_ptr_in_abstract_decl, [resharper_]space_before_ptr_in_abstract_decl

Possible values:

true | false

Examples:

true
template <class T = int *, int *> foo() { int** p = new int *{new int{10}}; }
false
template <class T = int*, int*> foo() { int** p = new int*{new int{10}}; }

Before ref in declaration of variable

Property names:

[resharper_]cpp_space_before_ref_in_data_member, [resharper_]space_before_ref_in_data_member

Possible values:

true | false

Examples:

true
int && data;
false
int&& data;

After ref in declaration of variable

Property names:

[resharper_]cpp_space_after_ref_in_data_member, [resharper_]space_after_ref_in_data_member

Possible values:

true | false

Examples:

true
int&& data;
false
int&&data;

Before ref in declaration of multiple variables

Property names:

[resharper_]cpp_space_before_ref_in_data_members, [resharper_]space_before_ref_in_data_members

Possible values:

true | false

Examples:

true
int **data, *data2, &data3 = &data2;
false
int **data, *data2,&data3 = &data2;

After ref in declaration of multiple variables

Property names:

[resharper_]cpp_space_after_ref_in_data_members, [resharper_]space_after_ref_in_data_members

Possible values:

true | false

Examples:

true
int **data, *data2, & data3 = &data2;
false
int **data, *data2, &data3 = &data2;

Before ref in return type of function

Property names:

[resharper_]cpp_space_before_ref_in_method, [resharper_]space_before_ref_in_method

Possible values:

true | false

Examples:

true
int & foo(int a, int b);
false
int& foo(int a, int b);

After ref in return type of function

Property names:

[resharper_]cpp_space_after_ref_in_method, [resharper_]space_after_ref_in_method

Possible values:

true | false

Examples:

true
int& foo(int a, int b);
false
int&foo(int a, int b);

Before ref in abstract declaration

Property names:

[resharper_]cpp_space_before_ref_in_abstract_decl, [resharper_]space_before_ref_in_abstract_decl

Possible values:

true | false

Examples:

true
template <class T = int &, int &> foo();
false
template <class T = int&, int&> foo();

After comma in declaration of multiple variables

Property names:

[resharper_]cpp_space_after_comma_in_declaration, [resharper_]cpp_space_after_comma, [resharper_]space_after_comma_in_declaration, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true
int a, b, c;
false
int a,b,c;

Before comma in declaration of multiple variables

Property names:

[resharper_]cpp_space_before_comma_in_declaration, [resharper_]cpp_space_before_comma, [resharper_]space_before_comma_in_declaration, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true
int a , b , c;
false
int a, b, c;

After comma in function parameters

Property names:

[resharper_]cpp_space_after_comma_in_method, [resharper_]cpp_space_after_comma, [resharper_]space_after_comma_in_method, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true
int foo(int a, int b, int c);
false
int foo(int a,int b,int c);

Before comma in function parameters

Property names:

[resharper_]cpp_space_before_comma_in_method, [resharper_]cpp_space_before_comma, [resharper_]space_before_comma_in_method, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true
int foo(int a , int b , int c);
false
int foo(int a, int b, int c);

After comma in enum

Property names:

[resharper_]cpp_space_after_comma_in_enum, [resharper_]cpp_space_after_comma, [resharper_]space_after_comma_in_enum, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true
enum Thing { One, Two, Three }
false
enum Thing { One,Two,Three }

Before comma in enum

Property names:

[resharper_]cpp_space_before_comma_in_enum, [resharper_]cpp_space_before_comma, [resharper_]space_before_comma_in_enum, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true
enum Thing { One , Two , Three }
false
enum Thing { One, Two, Three }

After comma in base clause

Property names:

[resharper_]cpp_space_after_comma_in_base_clause, [resharper_]cpp_space_after_comma, [resharper_]space_after_comma_in_base_clause, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true
class A : B, C, D
false
class A : B,C,D

Before comma in base clause

Property names:

[resharper_]cpp_space_before_comma_in_base_clause, [resharper_]cpp_space_before_comma, [resharper_]space_before_comma_in_base_clause, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true
class A : B , C , D
false
class A : B, C, D

Before parentheses in function parameters

Property names:

[resharper_]cpp_space_between_method_declaration_name_and_open_parenthesis, [resharper_]space_between_method_declaration_name_and_open_parenthesis

Possible values:

true | false

Examples:

true
int foo (int a, int b, int c);
false
int foo(int a, int b, int c);

Before parentheses in lambda parameters

Property names:

[resharper_]cpp_space_before_lambda_parentheses, [resharper_]space_before_lambda_parentheses

Possible values:

true | false

Examples:

true
auto lambda = [] (int, int) { };
false
auto lambda = [](int, int) { };

Within parentheses in function parameters

Property names:

[resharper_]cpp_space_between_method_declaration_parameter_list_parentheses, [resharper_]space_between_method_declaration_parameter_list_parentheses

Possible values:

true | false

Examples:

true
int foo( int a, int b, int c );
false
int foo(int a, int b, int c);

Within empty parentheses in function parameters

Property names:

[resharper_]cpp_space_between_method_declaration_empty_parameter_list_parentheses, [resharper_]space_between_method_declaration_empty_parameter_list_parentheses

Possible values:

true | false

Examples:

true
int foo( );
false
int foo();

Before angle brackets in template parameters

Property names:

[resharper_]cpp_space_before_template_params, [resharper_]space_before_template_params

Possible values:

true | false

Examples:

true
template <typename K, typename V> struct map { };
false
template<typename K, typename V> struct map { };

Within angle brackets in template parameters

Property names:

[resharper_]cpp_space_within_template_params, [resharper_]space_within_template_params

Possible values:

true | false

Examples:

true
template < typename K, typename V > struct map { };
false
template <typename K, typename V> struct map { };

Within empty angle brackets in template parameters

Property names:

[resharper_]cpp_space_within_empty_template_params, [resharper_]space_within_empty_template_params

Possible values:

true | false

Examples:

true
template < > struct vector<bool> { };
false
template <> struct vector<bool> { };

After comma in template parameters

Property names:

[resharper_]cpp_space_after_comma_in_template_params, [resharper_]cpp_space_after_comma, [resharper_]space_after_comma_in_template_params, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true
template <typename K, typename V> struct map { };
false
template <typename K,typename V> struct map { };

Before comma in template parameters

Property names:

[resharper_]cpp_space_before_comma_in_template_params, [resharper_]cpp_space_before_comma, [resharper_]space_before_comma_in_template_params, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true
template <typename K , typename V> struct map { };
false
template <typename K, typename V> struct map { };

Before angle brackets in template arguments

Property names:

[resharper_]cpp_space_before_template_args, [resharper_]space_before_template_args

Possible values:

true | false

Examples:

true
map <int, int> foo();
false
map<int, int> foo();

Within angle brackets in template arguments

Property names:

[resharper_]cpp_space_within_template_args, [resharper_]space_within_template_args

Possible values:

true | false

Examples:

true
map< int, int > foo();
false
map<int, int> foo();

After comma in template arguments

Property names:

[resharper_]cpp_space_after_comma_in_template_args, [resharper_]cpp_space_after_comma, [resharper_]space_after_comma_in_template_args, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true
map<int, int> foo();
false
map<int,int> foo();

Before comma in template arguments

Property names:

[resharper_]cpp_space_before_comma_in_template_args, [resharper_]cpp_space_before_comma, [resharper_]space_before_comma_in_template_args, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true
map<int , int> foo();
false
map<int, int> foo();

Between closing angle brackets in template arguments

Property names:

[resharper_]cpp_space_between_closing_angle_brackets_in_template_args, [resharper_]space_between_closing_angle_brackets_in_template_args

Possible values:

true | false

Examples:

true
vector<vector<int> > v;
false
vector<vector<int>> v;

Around '=' in alias declaration and namespace alias

Property names:

[resharper_]cpp_space_around_alias_eq, [resharper_]space_around_alias_eq

Possible values:

true | false

Examples:

true
namespace mpl = boost::mpl; using vec = std::vector;
false
namespace mpl=boost::mpl; using vec=std::vector;

Around '->' in trailing return types

Property names:

[resharper_]cpp_space_around_deref_in_trailing_return_type, [resharper_]space_around_deref_in_trailing_return_type

Possible values:

true | false

Examples:

true
auto foo() -> int;
false
auto foo()->int;

Before base types list colon

Property names:

[resharper_]cpp_space_before_colon_in_inheritance_clause, [resharper_]space_before_colon_in_inheritance_clause

Possible values:

true | false

Examples:

true
class Derived : BaseClass, Interface { };
false
class Derived: BaseClass, Interface { };

After base types list colon

Property names:

[resharper_]cpp_space_after_colon_in_inheritance_clause, [resharper_]space_after_colon_in_inheritance_clause

Possible values:

true | false

Examples:

true
class Derived : BaseClass, Interface { };
false
class Derived :BaseClass, Interface { };

Before C++/CLI generic constraint colon

Property names:

[resharper_]cpp_space_before_type_parameter_constraint_colon, [resharper_]space_before_type_parameter_constraint_colon

Possible values:

true | false

Examples:

true
generic<class T> class C where T : IEnumerable{};
false
generic<class T> class C where T : IEnumerable{};

After C++/CLI generic constraint colon

Property names:

[resharper_]cpp_space_after_type_parameter_constraint_colon, [resharper_]space_after_type_parameter_constraint_colon

Possible values:

true | false

Examples:

true
generic<class T> class C where T : IEnumerable{};
false
generic<class T> class C where T : IEnumerable{};

In control statements

Before parentheses

Property names:

[resharper_]cpp_space_after_keywords_in_control_flow_statements, [resharper_]space_after_keywords_in_control_flow_statements

Possible values:

true | false

Examples:

true
while (true) { }
false
while(true) { }

Within parentheses

Property names:

[resharper_]cpp_space_between_parentheses_of_control_flow_statements, [resharper_]space_between_parentheses_of_control_flow_statements

Possible values:

true | false

Examples:

true
do { } while ( true )
false
do { } while (true)

Before semicolon in for statement

Property names:

[resharper_]cpp_space_before_semicolon_in_for_statement, [resharper_]space_before_semicolon_in_for_statement

Possible values:

true | false

Examples:

true
for (int i = 1 ; i < 10 ; i++) { }
false
for (int i = 1; i < 10; i++) { }

After semicolon in for statement

Property names:

[resharper_]cpp_space_after_semicolon_in_for_statement, [resharper_]space_after_semicolon_in_for_statement

Possible values:

true | false

Examples:

true
for (int i = 1; i < 10; i++) { }
false
for (int i = 1;i < 10;i++) { }

Before ':' in range-based for loop

Property names:

[resharper_]cpp_space_before_for_colon, [resharper_]space_before_for_colon

Possible values:

true | false

Examples:

true
for (auto x : list) { }
false
for (auto x: list) { }

After ':' in range-based for loop

Property names:

[resharper_]cpp_space_after_for_colon, [resharper_]space_after_for_colon

Possible values:

true | false

Examples:

true
for (auto x : list) { }
false
for (auto x :list) { }

Before colon in switch case or label statement

Property names:

[resharper_]cpp_space_before_colon_in_case, [resharper_]space_before_colon_in_case

Possible values:

true | false

Examples:

true
switch (a) { case b : break; }
false
switch (a) { case b: break; }

After colon in switch case or label statement

Property names:

[resharper_]cpp_space_after_colon_in_case, [resharper_]space_after_colon_in_case

Possible values:

true | false

Examples:

true
switch (a) { case b: break; }
false
switch (a) { case b:break; }

In expressions

Around binary operator

Property names:

[resharper_]cpp_space_around_binary_operator, [resharper_]space_around_binary_operator

Possible values:

true | false

Examples:

true
a + b
false
a+b

Around assignment operator

Property names:

[resharper_]cpp_space_around_assignment_operator, [resharper_]space_around_assignment_operator

Possible values:

true | false

Examples:

true
a = b;
false
a=b;

Around dot, '->', '.*' and '->.'

Property names:

[resharper_]cpp_space_around_dot, [resharper_]cpp_space_around_member_access_operator, [resharper_]space_around_dot, [resharper_]space_around_member_access_operator

Possible values:

true | false

Examples:

true
obj -> method()
false
obj->method()

Within parentheses

Property names:

[resharper_]cpp_space_within_parentheses, [resharper_]space_within_parentheses

Possible values:

true | false

Examples:

true
( a + b )->method();
false
(a + b)->method();

Before array subscript brackets

Property names:

[resharper_]cpp_space_before_open_square_brackets, [resharper_]space_before_open_square_brackets

Possible values:

true | false

Examples:

true
a [i]
false
a[i]

Within array subscript brackets

Property names:

[resharper_]cpp_space_within_array_access_brackets, [resharper_]cpp_space_between_square_brackets, [resharper_]space_within_array_access_brackets, [resharper_]space_between_square_brackets

Possible values:

true | false

Examples:

true
a[ i ]
false
a[i]

Before parentheses in function call and initialization

Property names:

[resharper_]cpp_space_before_method_call_parentheses, [resharper_]cpp_space_between_method_call_name_and_opening_parenthesis, [resharper_]space_before_method_call_parentheses, [resharper_]space_between_method_call_name_and_opening_parenthesis

Possible values:

true | false

Examples:

true
foo (a, b, c);
false
foo(a, b, c);

Before empty parentheses in function call and initialization

Property names:

[resharper_]cpp_space_before_empty_method_call_parentheses, [resharper_]cpp_space_between_method_call_name_and_opening_parenthesis, [resharper_]space_before_empty_method_call_parentheses, [resharper_]space_between_method_call_name_and_opening_parenthesis

Possible values:

true | false

Examples:

true
foo ();
false
foo();

Within parentheses in cast expressions

Property names:

[resharper_]cpp_space_between_typecast_parentheses, [resharper_]space_between_typecast_parentheses

Possible values:

true | false

Examples:

true
( int )0.5;
false
(int)0.5;

After parentheses in cast expressions

Property names:

[resharper_]cpp_space_after_cast, [resharper_]space_after_cast

Possible values:

true | false

Examples:

true
(int) 0.5;
false
(int)0.5;

Within parentheses in function call and initialization

Property names:

[resharper_]cpp_space_between_method_call_parameter_list_parentheses, [resharper_]space_between_method_call_parameter_list_parentheses

Possible values:

true | false

Examples:

true
foo( a, b, c );
false
foo(a, b, c);

Within empty parentheses in function call and initialization

Property names:

[resharper_]cpp_space_between_method_call_empty_parameter_list_parentheses, [resharper_]space_between_method_call_empty_parameter_list_parentheses

Possible values:

true | false

Examples:

true
foo( );
false
foo();

Before comma in function call and initialization

Property names:

[resharper_]cpp_space_before_comma_in_method_call, [resharper_]cpp_space_before_comma, [resharper_]space_before_comma_in_method_call, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true
foo(a , b , c);
false
foo(a, b, c);

After comma in function call and initialization

Property names:

[resharper_]cpp_space_after_comma_in_method_call, [resharper_]cpp_space_after_comma, [resharper_]space_after_comma_in_method_call, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true
foo(a, b, c);
false
foo(a,b,c);

Before comma in uniform initialization braces

Property names:

[resharper_]cpp_space_before_comma_in_initializer_braces, [resharper_]cpp_space_before_comma, [resharper_]space_before_comma_in_initializer_braces, [resharper_]space_before_comma

Possible values:

true | false

Examples:

true
MyClass x{1 , 2 , 3};
false
MyClass x{1, 2, 3};

After comma in uniform initialization braces

Property names:

[resharper_]cpp_space_after_comma_in_initializer_braces, [resharper_]cpp_space_after_comma, [resharper_]space_after_comma_in_initializer_braces, [resharper_]space_after_comma

Possible values:

true | false

Examples:

true
MyClass x{1, 2, 3};
false
MyClass x{1,2,3};

In ternary operator '? :' before '?'

Property names:

[resharper_]cpp_space_before_ternary_quest, [resharper_]space_before_ternary_quest

Possible values:

true | false

Examples:

true
a ? b : c
false
a? b : c

In ternary operator '? :' after '?'

Property names:

[resharper_]cpp_space_after_ternary_quest, [resharper_]space_after_ternary_quest

Possible values:

true | false

Examples:

true
a ? b : c
false
a ?b : c

In ternary operator '? :' before ':'

Property names:

[resharper_]cpp_space_before_ternary_colon, [resharper_]space_before_ternary_colon

Possible values:

true | false

Examples:

true
a ? b : c
false
a ? b: c

In ternary operator '? :' after ':'

Property names:

[resharper_]cpp_space_after_ternary_colon, [resharper_]space_after_ternary_colon

Possible values:

true | false

Examples:

true
a ? b : c
false
a ? b :c

Before uniform initialization braces

Property names:

[resharper_]cpp_space_before_initializer_braces, [resharper_]space_before_initializer_braces

Possible values:

true | false

Examples:

true
auto e = complex {3, 4};
false
auto e = complex{3, 4};

Within uniform initialization braces

Property names:

[resharper_]cpp_space_within_initializer_braces, [resharper_]space_within_initializer_braces

Possible values:

true | false

Examples:

true
auto e = complex{ 3, 4 };
false
auto e = complex{3, 4};

Within empty uniform initialization braces

Property names:

[resharper_]cpp_space_within_empty_initializer_braces, [resharper_]space_within_empty_initializer_braces

Possible values:

true | false

Examples:

true
auto e = int{ };
false
auto e = int{};

Other

Before end of line comment

Property names:

[resharper_]cpp_space_before_trailing_comment, [resharper_]space_before_trailing_comment

Possible values:

true | false

Examples:

true
int x = 4; // x = 4
false
int x = 4;// x = 4

Preserve spaces before end of line comment

Property names:

[resharper_]cpp_disable_space_changes_before_trailing_comment, [resharper_]disable_space_changes_before_trailing_comment

Possible values:

true | false

Examples:

true
int x = 4; // x = 4
false
int x = 4; // x = 4
Last modified: 08 March 2021