From 1daad8efe07ebeed63168814a750f2b460b000f3 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 30 Sep 2026 07:33:11 +0200 Subject: [PATCH] Avoid astyle's padding in ordered_map::emplace's template headers Use detail::conjunction instead of && and drop the redundant V&& in detail::is_constructible, so astyle keeps the usual template formatting. Addresses review comment by @gregmarr. Signed-off-by: Niels Lohmann --- include/nlohmann/ordered_map.hpp | 10 +++++----- single_include/nlohmann/json.hpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/nlohmann/ordered_map.hpp b/include/nlohmann/ordered_map.hpp index e17b8333a..8f94b088c 100644 --- a/include/nlohmann/ordered_map.hpp +++ b/include/nlohmann/ordered_map.hpp @@ -70,8 +70,8 @@ template , return *this; } - template < class V, detail::enable_if_t < - detail::is_constructible < T, V&& >::value, int > = 0 > + template::value, int> = 0> std::pair emplace(const key_type& key, V && t) { for (auto it = this->begin(); it != this->end(); ++it) @@ -85,9 +85,9 @@ template , return {std::prev(this->end()), true}; } - template < class KeyType, class V, detail::enable_if_t < - detail::is_usable_as_key_type::value&& - detail::is_constructible < T, V&& >::value, int > = 0 > + template, + detail::is_constructible>::value, int> = 0> std::pair emplace(KeyType && key, V && t) { for (auto it = this->begin(); it != this->end(); ++it) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index a6b320e71..8b360c700 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -25832,8 +25832,8 @@ template , return *this; } - template < class V, detail::enable_if_t < - detail::is_constructible < T, V&& >::value, int > = 0 > + template::value, int> = 0> std::pair emplace(const key_type& key, V && t) { for (auto it = this->begin(); it != this->end(); ++it) @@ -25847,9 +25847,9 @@ template , return {std::prev(this->end()), true}; } - template < class KeyType, class V, detail::enable_if_t < - detail::is_usable_as_key_type::value&& - detail::is_constructible < T, V&& >::value, int > = 0 > + template, + detail::is_constructible>::value, int> = 0> std::pair emplace(KeyType && key, V && t) { for (auto it = this->begin(); it != this->end(); ++it)