Search code examples
c++uncrustify

Uncrustify: remove space between template angles doesn't work


I'd like to remove space between template angles, for example:

void Function (list<list<int> >);
                             ^
                             |
              This space should be removed.

For this purpose I use sp_angle_shift = remove, but is has no effect.

$ uncrustify -c uncrustify.cfg function.h --no-backup -l CPP

Input

void Function (const list<list<T> > data);

void Function (const list<list<T> > data)
{
}

Output: the same.

How to remove spaces between angles?


Solution

  • upgrade uncrustify to 0.60 and add/modify :

    sp_angle_shift                           = remove
    sp_permit_cpp11_shift                    = true
    

    For your information :

    # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add
    sp_angle_shift                           = add      # ignore/add/remove/force
    
    # Permit removal of the space between '>>' in 'foo<bar<int> >' (C++11 only). Default=False
    # sp_angle_shift cannot remove the space without this option.
    sp_permit_cpp11_shift                    = false    # false/true