Skip to content

Alignment issue when passing lambda as function parameter #1340

Closed

Description

@ttnghia

Hi,

I have an alignment issue when using lambda. Usually, I have successfully set up uncrustify config and get the alignment like this:

double t    = 0; 
double t1   = 0; 
double t111 = 0;

When I write a lambda, I also get the desired effect:

auto f = [](double x) -> double
         {
             double t    = 0;
             double t1   = 0;
             double t111 = 0;

             return ...;
         };

However, when I write a lambda as a parameter passed to a function, I cannot get the assignment '=' of variables t, t1, t111 aligned anymore:

std::transform(v1.begin(), v1.end(), v2.begin(),
               [](double x) -> double
               {
                   double t = 0;
                   double t1 = 0;
                   double t111 = 0;

                   return ...;
               }; );

For nested lambda, I don't have such problem:

auto f = [](double x) -> double
         {
             auto f = [](double x) -> double
                      {
                          auto f = [](double x) -> double
                                   {
                                       double t    = 0;
                                       double t1   = 0;
                                       double t111 = 0;

                                       return ...;
                                   };

                          return ...;
                      };

             return ...;
         };

I have tried to change many parameters in the config file including align_assign_span and align_assign_thresh, but could not succeed. Did I miss something?

Activity

  1. guy-maurel commented on Oct 2, 2017

    @guy-maurel
    Contributor

    Are you using an empty configuration file?
    If not, push it just now.

  2. ttnghia commented on Oct 2, 2017

    @ttnghia
    Author

    I have a lot of configs in my config file. Here it is: MyUncrustify.txt

  3. guy-maurel commented on Oct 9, 2017

    @guy-maurel
    Contributor

    I am working on it.

  4. guy-maurel commented on Oct 12, 2017

    @guy-maurel
    Contributor

    #1375 is a bugfix proposal.
    Please test and report.

  5. ttnghia commented on Oct 12, 2017

    @ttnghia
    Author

    Tested. That works! Thanks very much 👍

  6. added a commit that references this issue on Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions