Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto formatter changes > > to >>

I'm having a problem with the C++ extension of VScode. Whenever I define a matrix consisting of vectors like vector<vector<int> > and use the auto formatter, it changes the code to vector<vector<int>> which results in a compiler error.

Is there any solution to this?

like image 749
ErebosM Avatar asked Sep 10 '25 08:09

ErebosM


1 Answers

The VSCode C++ extension uses clang-format for formatting the document. If you are stuck with an old compiler which doesn't support C++11, just add a .clang-format file in your workspace with following line:

Standard : Cpp03

For more formatting options, refer to the following link: https://clang.llvm.org/docs/ClangFormatStyleOptions.html

like image 152
Nishant Singh Avatar answered Sep 12 '25 22:09

Nishant Singh