From ed8418befb9530b350e0d67edbf3f8c3eb2fb27c Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Wed, 15 Jan 2025 15:31:22 +0100 Subject: [PATCH] Deprecate usage of PdiEvent::and_with by PdiEvent::with --- include/ddc/pdi.hpp | 8 ++++++-- tests/pdi/pdi.cpp | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/ddc/pdi.hpp b/include/ddc/pdi.hpp index dcfc80611..d883fb6b8 100644 --- a/include/ddc/pdi.hpp +++ b/include/ddc/pdi.hpp @@ -122,11 +122,13 @@ class PdiEvent return *this; } +#if defined(DDC_BUILD_DEPRECATED_CODE) template - PdiEvent& and_with(std::string const& name, T&& t) + [[deprecated("Use 'with' instead.")]] PdiEvent& and_with(std::string const& name, T&& t) { return with(name, std::forward(t)); } +#endif /// @} /// API with access deduction @@ -148,12 +150,14 @@ class PdiEvent return with>(name, std::forward(data)); } +#if defined(DDC_BUILD_DEPRECATED_CODE) /// With synonym template - PdiEvent& and_with(std::string const& name, T&& t) + [[deprecated("Use 'with' instead.")]] PdiEvent& and_with(std::string const& name, T&& t) { return with(name, std::forward(t)); } +#endif /// @} }; diff --git a/tests/pdi/pdi.cpp b/tests/pdi/pdi.cpp index 2ea64999c..0a9984c61 100644 --- a/tests/pdi/pdi.cpp +++ b/tests/pdi/pdi.cpp @@ -109,15 +109,15 @@ TEST(Pdi, ChunkAndChunkSpan) ddc::PdiEvent("some_event") .with("pdi_chunk_label", chunk) - .and_with("nb_event_called", nb_event_called); + .with("nb_event_called", nb_event_called); ddc::PdiEvent("some_event") .with("pdi_chunk_label", chunk.span_view()) - .and_with("nb_event_called", nb_event_called); + .with("nb_event_called", nb_event_called); ddc::PdiEvent("some_event") .with("pdi_chunk_label", chunk.span_cview()) - .and_with("nb_event_called", nb_event_called); + .with("nb_event_called", nb_event_called); EXPECT_EQ(nb_event_called, 3); }