Author Topic: How do you get C++ lambdas to indent reasonably?  (Read 3880 times)

chrimc

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
How do you get C++ lambdas to indent reasonably?
« on: May 09, 2012, 05:35:13 pm »
I can get SlickEdit 2010, or 2011 to indent lambdas in any reasonable way.  Here for example is what the beautified version of one of my functions looks like.
TPUtils::parallel_for(0, rgDecoders.size(), [&](size_t uDecoder){
                                              CWidSet widSet(spLocalRestrictions->GetAllocator());
                                             CIndexScanStats stats;
                                             auto vi = rgDecoders[uDecoder]->ScanValueIndex(keyRange, spLocalRestrictions, VI_DEFAULT);
                                             SKeyWidData data;
                                             while (vi->NextKey(&data)){
                                             for(auto itWID = data.pWidStart; itWID != data.pWidEnd; ++itWID){
                                             widSet.m_wids.Set(*itWID);
                                             }
                                             }
                                             CCriticalSectionLock lock(cs);
                                             widResults.Union(std::move(widSet.m_wids));
                                             }
                                             );

chrimc

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: How do you get C++ lambdas to indent reasonably?
« Reply #1 on: May 10, 2012, 03:38:35 pm »
Anyone?  I might have to switch to Visual Studio... :-(

pmwhite

  • Community Member
  • Posts: 98
  • Hero Points: 7
Re: How do you get C++ lambdas to indent reasonably?
« Reply #2 on: May 10, 2012, 04:05:18 pm »
Before giving up, consider opening an official support ticket. (Not through this forum.)

lambertia

  • Senior Community Member
  • Posts: 382
  • Hero Points: 14
  • I have nothing sufficiently witty to say.
Re: How do you get C++ lambdas to indent reasonably?
« Reply #3 on: May 10, 2012, 11:18:27 pm »
Hi,

I pasted your code into the 2012 beta and after bedutification it looks like this:

Code: [Select]
TPUtils::parallel_for(0, rgDecoders.size(),[&](size_t uDecoder)
{
   CWidSet widSet(spLocalRestrictions->GetAllocator());
   CIndexScanStats stats;
   auto vi = rgDecoders[uDecoder]->ScanValueIndex(keyRange, spLocalRestrictions, VI_DEFAULT);
   SKeyWidData data;
   while (vi->NextKey(&data))
   {
      for(auto itWID = data.pWidStart; itWID != data.pWidEnd; ++itWID)
      {
         widSet.m_wids.Set(*itWID);
      }
   }
   CCriticalSectionLock lock(cs);
   widResults.Union(std::move(widSet.m_wids));
}
                      );

So SE2012 could be your answer?

Cheers,
--
Greg.