From d4a024ea75a5bc0d50def0d8905c0470a3f46b2b Mon Sep 17 00:00:00 2001 From: peri4 Date: Mon, 6 May 2024 19:22:22 +0300 Subject: [PATCH] remove harmful createPIPair() --- libs/main/containers/pipair.h | 13 --------- main.cpp | 54 +++++++++++++++++++++++++++++++---- 2 files changed, 49 insertions(+), 18 deletions(-) diff --git a/libs/main/containers/pipair.h b/libs/main/containers/pipair.h index cfdee8d7..8c3c351e 100644 --- a/libs/main/containers/pipair.h +++ b/libs/main/containers/pipair.h @@ -124,19 +124,6 @@ inline PICout operator<<(PICout s, const PIPair & v) { } -//! \~english Creates \a PIPair object, deducing the target type from the types of arguments. -//! \~russian Создает \a PIPair выводя типы из аргументов. -//! \~\details -//! \~\code -//! auto p = createPIPair(1, 'a'); -//! piCout << p; // (1, a) -//! \endcode -template -PIPair createPIPair(const T1 & f, const T2 & s) { - return PIPair(f, s); -} - - //! \~english Creates \a PIPair object, deducing the target type from the types of arguments. //! \~russian Создает \a PIPair выводя типы из аргументов. //! \sa \a createPIPair() diff --git a/main.cpp b/main.cpp index ba615963..538bf967 100644 --- a/main.cpp +++ b/main.cpp @@ -9,7 +9,6 @@ using namespace PICoutManipulators; - int main(int argc, char * argv[]) { /*PISerial ser; ser.setSpeed(PISerial::S115200); @@ -18,9 +17,54 @@ int main(int argc, char * argv[]) { ser.startThreadedRead(); (2_s).sleep(); ser.stopAndWait();*/ - PISet set = {1, 3, 4}; - set |= PISet{2, 4}; - set -= PISet{2}; - piCout << set << (set & PISet{1, 2, 4}); + + /*auto test = [](PISystemTime t) { + piCout << "---------------"; + piCout << t << t.toString(); + piCout << PISystemTime::fromString(t.toString()) << PISystemTime::fromString(t.toString()).toString(); + piCout << PIVariant(t); + piCout << PIVariant(t).toString(); + }; + auto test_str = [](PIString s) { + piCout << "---------------"; + piCout << s; + piCout << PISystemTime::fromString(s) << PISystemTime::fromString(s).toString(); + }; + + test(PISystemTime::current()); + test(1000.123_d); + test(61_s); + test(59_s); + test(1234_us); + test(5000001_ns); + + test_str(""); + test_str("2020-05-04"); + test_str("2020-05-04 11:12:13"); + test_str("11:12:13"); + test_str("11:12:13.405"); + test_str("100"); + test_str("5 s"); + test_str("5s"); + test_str("1000 d 2 h 57 m 7 s 200 ms 2 ns"); + test_str("0.2 d"); + test_str(".5d"); + test_str("3E+2us"); + test_str("0.1d 200millis"); + test_str("2h 15 seconds"); + test_str("4secs 2hours 100 ns 3m 5ms 1 day 6 micros "); + + test_str("1hz"); + test_str("5.123khz"); + test_str("5khz 123 hz"); + test_str("2mhz"); + test_str("1ghz"); + test_str("1hz 1hz");*/ + + // PIPair p = createPIPair(0, ""); + PIVector> pv; + pv << createPIPair(0, PIString()); + + return 0; }