Hi everybody,
I was wondering why clang-format does not align consecutive typedef as one might expect.
As an example, what i except from the following code:
typedef hash_table_iterator<T, key_type, hash_type> iterator;
typedef hash_table_iterator<T, key_type, hash_type, true> const_iterator;
typedef std::pair<key_type, T> value_type;
is an alignment like (when the option AlignConsecutiveDeclarations is true):
typedef hash_table_iterator<T, key_type, hash_type> iterator;
typedef hash_table_iterator<T, key_type, hash_type, true> const_iterator;
typedef std::pair<key_type, T> value_type;
but no change is applied by clan-format.
Looking at the code, what prevents the formatting is the number of commas found before the “declaration name”, i.e. iterator, const_iterator and value_type. If the number of commas changes from one declaration to the next one, the sequence of declaration to align is interrupted.
Is this behavior intentional?
Valentino Picotti