diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-08-01 09:09:57 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-08-01 09:09:57 +0100 |
| commit | 284708d1e8a14867b5276a8e760588d8531835d8 (patch) | |
| tree | 9f651db6d8b51bf97f2fd2fb41efbf5e53498eea /dev/examples | |
| parent | 574d373163f7edade42e935b9e6957cdaf08d94b (diff) | |
feat: generic: new `except` module, network model for FIX, and tracked_ptr improvements.
feat: introduce the `must_pass` concept to validate a container.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/examples')
| -rw-r--r-- | dev/examples/fix/fix.cc | 4 | ||||
| -rw-r--r-- | dev/examples/opt/opt.cc | 4 | ||||
| -rw-r--r-- | dev/examples/tracked_ptr/tracked_ptr.cc | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/dev/examples/fix/fix.cc b/dev/examples/fix/fix.cc index f67d8a0..620d7d6 100644 --- a/dev/examples/fix/fix.cc +++ b/dev/examples/fix/fix.cc @@ -13,10 +13,10 @@ int main(int argc, char** argv) snu::fix::visitor<char> visitor; snu::fix::range_data<char> fix = visitor.visit("8=FIX.4.2|9=65|35=A|49=SERVER|56=CLIENT|34=177|52=20090107-18:15:16|98=0|108=30|10=062|"); - std::cout << "magic: " << fix.msg_magic_ << std::endl; + std::cout << "magic: " << fix.magic_ << std::endl; std::cout << "is_valid: " << std::boolalpha << fix.is_valid() << std::endl; - for (auto fields : fix.msg_body_) + for (auto fields : fix.body_) { std::cout << "key: " << fields.first; std::cout << ", value: " << fields.second << std::endl; diff --git a/dev/examples/opt/opt.cc b/dev/examples/opt/opt.cc index a914d8d..d1324e7 100644 --- a/dev/examples/opt/opt.cc +++ b/dev/examples/opt/opt.cc @@ -25,7 +25,7 @@ static auto do_some(const std::string recv_data, const std::string check_data) const int hash_to_check = do_hash(check_data); /* here we assume this should match opt_hash */ const int opt_hash = do_hash(recv_data); /* we assume that the hash is correct */ - auto opt = snu::opt::opt(snu::opt::eval_eq(hash_to_check, opt_hash)); /* do the compute */ + auto opt = snu::opt(snu::eval_eq(hash_to_check, opt_hash)); /* do the compute */ return opt; } @@ -34,7 +34,7 @@ int main(int argc, char** argv) { // ... let's assume we fetch data from network... - snu::println("Testing data..."); + snu::io::println("Testing data..."); auto opt = do_some("Ohio", "Ohio"); opt.expect("Checksum failed, Ohio isn't Ohio!"); diff --git a/dev/examples/tracked_ptr/tracked_ptr.cc b/dev/examples/tracked_ptr/tracked_ptr.cc index c182494..5ce6f61 100644 --- a/dev/examples/tracked_ptr/tracked_ptr.cc +++ b/dev/examples/tracked_ptr/tracked_ptr.cc @@ -48,5 +48,7 @@ int main(int argc, char** argv) std::cout << "leak-detected=" << std::boolalpha << (ptr.manager().allocator().allocated_count_ > ptr.manager().allocator().deallocated_count_) << std::endl; - return 0; + snu::memory::must_pass(ptr); + + return EXIT_SUCCESS; } |
