File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1525,6 +1525,11 @@ using wformat_context = buffer_context<wchar_t>;
15251525#define FMT_BUFFER_CONTEXT (Char ) \
15261526 basic_format_context<detail::buffer_appender<Char>, Char>
15271527
1528+ template <typename T, typename Char = char >
1529+ using is_formattable = bool_constant<!std::is_same<
1530+ decltype (detail::arg_mapper<buffer_context<Char>>().map(std::declval<T>())),
1531+ detail::unformattable>::value>;
1532+
15281533/* *
15291534 \rst
15301535 An array of references to arguments. It can be implicitly converted into
Original file line number Diff line number Diff line change @@ -617,6 +617,12 @@ TEST(CoreTest, HasFormatter) {
617617 " " );
618618}
619619
620+ TEST (CoreTest, IsFormattable) {
621+ static_assert (fmt::is_formattable<enabled_formatter>::value, " " );
622+ static_assert (!fmt::is_formattable<disabled_formatter>::value, " " );
623+ static_assert (fmt::is_formattable<disabled_formatter_convertible>::value, " " );
624+ }
625+
620626struct convertible_to_int {
621627 operator int () const { return 42 ; }
622628};
You can’t perform that action at this time.
0 commit comments