[PATCH] D44609: [Clang-Format] New option BreakBeforeLambdaBody to manage lambda line break inside function parameter call

Francois JEAN via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 23 15:23:49 PDT 2018


Wawha added a comment.

  Hi djasper,

Here a project where there is lambda and allman style for them : 
https://github.com/boostorg/hof/blob/develop/example/in.cpp
https://github.com/boostorg/hof/blob/develop/example/sequence.cpp

Example of code:

  // Function to find an iterator using a containers built-in find if available
  BOOST_HOF_STATIC_LAMBDA_FUNCTION(find_iterator) = first_of(
      [](const std::string& s, const auto& x)
      {
          auto index = s.find(x);
          if (index == std::string::npos) return s.end();
          else return s.begin() + index;
      },
  #ifdef _MSC_VER
      // On MSVC, trailing decltype doesn't work with generic lambdas, so a
      // seperate function can be used instead.
      BOOST_HOF_LIFT(member_find),
  #else
      [](const auto& r, const auto& x) BOOST_HOF_RETURNS(r.find(x)),
  #endif
      [](const auto& r, const auto& x)
      {
          using std::begin;
          using std::end;
          return std::find(begin(r), end(r), x);
      }
  );

What could be the next to move forward on this topic?
Do you think that some modification should be make on this patch? Change option name? Make it default behavior for allman?


Repository:
  rC Clang

https://reviews.llvm.org/D44609





More information about the cfe-commits mailing list