Visual Studio Code - C++ auto formatter changes > > to >>

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
7
down vote

favorite












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?










share|improve this question

















  • 4




    That sounds like you are using a really old compiler version where that parsing issue is not resolved by the language yet... Is upgrading to a newer compiler an option?
    – Max Langhof
    1 hour ago







  • 1




    You'd be hard-pressed to find a compiler that doesn't support this in C++11 mode. @Erebos Try adding -std=c++11 to the compiler flags.
    – rubenvb
    1 hour ago














up vote
7
down vote

favorite












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?










share|improve this question

















  • 4




    That sounds like you are using a really old compiler version where that parsing issue is not resolved by the language yet... Is upgrading to a newer compiler an option?
    – Max Langhof
    1 hour ago







  • 1




    You'd be hard-pressed to find a compiler that doesn't support this in C++11 mode. @Erebos Try adding -std=c++11 to the compiler flags.
    – rubenvb
    1 hour ago












up vote
7
down vote

favorite









up vote
7
down vote

favorite











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?










share|improve this question













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?







c++ visual-studio-code vscode-settings vscode-extensions autoformatting






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 1 hour ago









ErebosM

931112




931112







  • 4




    That sounds like you are using a really old compiler version where that parsing issue is not resolved by the language yet... Is upgrading to a newer compiler an option?
    – Max Langhof
    1 hour ago







  • 1




    You'd be hard-pressed to find a compiler that doesn't support this in C++11 mode. @Erebos Try adding -std=c++11 to the compiler flags.
    – rubenvb
    1 hour ago












  • 4




    That sounds like you are using a really old compiler version where that parsing issue is not resolved by the language yet... Is upgrading to a newer compiler an option?
    – Max Langhof
    1 hour ago







  • 1




    You'd be hard-pressed to find a compiler that doesn't support this in C++11 mode. @Erebos Try adding -std=c++11 to the compiler flags.
    – rubenvb
    1 hour ago







4




4




That sounds like you are using a really old compiler version where that parsing issue is not resolved by the language yet... Is upgrading to a newer compiler an option?
– Max Langhof
1 hour ago





That sounds like you are using a really old compiler version where that parsing issue is not resolved by the language yet... Is upgrading to a newer compiler an option?
– Max Langhof
1 hour ago





1




1




You'd be hard-pressed to find a compiler that doesn't support this in C++11 mode. @Erebos Try adding -std=c++11 to the compiler flags.
– rubenvb
1 hour ago




You'd be hard-pressed to find a compiler that doesn't support this in C++11 mode. @Erebos Try adding -std=c++11 to the compiler flags.
– rubenvb
1 hour ago












2 Answers
2






active

oldest

votes

















up vote
6
down vote













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



Standard : Cpp03


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






share|improve this answer



























    up vote
    3
    down vote













    The compiler error is that >> is interpreted as the right shift operator instead of two consecutive template argument list delimiters. Before C++11 this was how the language required the parser to work. However, in C++11, an exception was added to prevent this. See this answer for more information.



    The best solution would be to upgrade your compiler to C++11 or later.






    share|improve this answer




















      Your Answer





      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52928581%2fvisual-studio-code-c-auto-formatter-changes-to%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      6
      down vote













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



      Standard : Cpp03


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






      share|improve this answer
























        up vote
        6
        down vote













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



        Standard : Cpp03


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






        share|improve this answer






















          up vote
          6
          down vote










          up vote
          6
          down vote









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



          Standard : Cpp03


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






          share|improve this answer












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



          Standard : Cpp03


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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 1 hour ago









          Nishant Singh

          77369




          77369






















              up vote
              3
              down vote













              The compiler error is that >> is interpreted as the right shift operator instead of two consecutive template argument list delimiters. Before C++11 this was how the language required the parser to work. However, in C++11, an exception was added to prevent this. See this answer for more information.



              The best solution would be to upgrade your compiler to C++11 or later.






              share|improve this answer
























                up vote
                3
                down vote













                The compiler error is that >> is interpreted as the right shift operator instead of two consecutive template argument list delimiters. Before C++11 this was how the language required the parser to work. However, in C++11, an exception was added to prevent this. See this answer for more information.



                The best solution would be to upgrade your compiler to C++11 or later.






                share|improve this answer






















                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  The compiler error is that >> is interpreted as the right shift operator instead of two consecutive template argument list delimiters. Before C++11 this was how the language required the parser to work. However, in C++11, an exception was added to prevent this. See this answer for more information.



                  The best solution would be to upgrade your compiler to C++11 or later.






                  share|improve this answer












                  The compiler error is that >> is interpreted as the right shift operator instead of two consecutive template argument list delimiters. Before C++11 this was how the language required the parser to work. However, in C++11, an exception was added to prevent this. See this answer for more information.



                  The best solution would be to upgrade your compiler to C++11 or later.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  Max Langhof

                  5,921931




                  5,921931



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52928581%2fvisual-studio-code-c-auto-formatter-changes-to%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      List of Gilmore Girls characters

                      What does second last employer means? [closed]

                      One-line joke