I have looked at the clang-format style options https://clang.llvm.org/docs/ClangFormatStyleOptions.html but don't see any reference to c++ concepts and requires clauses. Normally I can configure clang-format to do what I want but I can't figure out how to get it to handle my concepts and requires clauses nicely:
template <typename F, typename P, typename T>
concept Accumulate_Fn = Parser<P>&& std::invocable<F, T, parser_t<P>>&&
std::same_as<T, std::invoke_result_t<F, T, parser_t<P>>>;
But I would like to put each one constraint on its own line (as it does for function arguments that get too long) so that the result would look like:
template <typename F, typename P, typename T>
concept Accumulate_Fn = Parser<P> &&
std::invocable<F, T, parser_t<P>> &&
std::same_as<T, std::invoke_result_t<F, T, parser_t<P>>>;
template <Parser P1, Parser P2, typename T, Accumulate_Fn<P1, parser_t<P1>> F>
requires std::same_as<T, parser_t<P1>> constexpr Parser auto
separated_by(P1&& p1, P2&& p2, T&& init, F&& f)
But I would like something much closer to :
template <Parser P1, Parser P2, typename T, Accumulate_Fn<P1, parser_t<P1>> F>
requires std::same_as<T, parser_t<P1>>
constexpr Parser auto separated_by(P1&& p1, P2&& p2, T&& init, F&& f)
Are there any magical options that will make that work? I'm currently on clang-format 10.0.
As of Jul/20, Concepts are not properly supported by clang-format
. There is an open issue in LLVM tracker.