From 1768f21de7b75c98c932fcd734218d348b1b0060 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 27 Feb 2026 17:49:09 +0100 Subject: =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D1=82=D1=80=D0=B5=D1=82=D1=8C=D1=8F=20=D0=B7=D0=B0=D0=B4?= =?UTF-8?q?=D0=B0=D1=87=D0=B0=20=D0=BF=D1=8F=D1=82=D0=BE=D0=B9=20=D0=B3?= =?UTF-8?q?=D0=BB=D0=B0=D0=B2=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../5/3_context/context.hpp" | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "\320\227\320\260\320\275\320\270\320\274\320\260\321\202\320\265\320\273\321\214\320\275\320\276\320\265 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\270\321\200\320\276\320\262\320\260\320\275\320\270\320\265/5/3_context/context.hpp" (limited to 'Занимательное программирование/5/3_context/context.hpp') diff --git "a/\320\227\320\260\320\275\320\270\320\274\320\260\321\202\320\265\320\273\321\214\320\275\320\276\320\265 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\270\321\200\320\276\320\262\320\260\320\275\320\270\320\265/5/3_context/context.hpp" "b/\320\227\320\260\320\275\320\270\320\274\320\260\321\202\320\265\320\273\321\214\320\275\320\276\320\265 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\270\321\200\320\276\320\262\320\260\320\275\320\270\320\265/5/3_context/context.hpp" new file mode 100644 index 0000000..519b601 --- /dev/null +++ "b/\320\227\320\260\320\275\320\270\320\274\320\260\321\202\320\265\320\273\321\214\320\275\320\276\320\265 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\270\321\200\320\276\320\262\320\260\320\275\320\270\320\265/5/3_context/context.hpp" @@ -0,0 +1,27 @@ +#include +#include "utf8.h" +#include + +struct context_occurrence +{ + unsigned int count{ 1 }; + std::unordered_map counts; + + explicit context_occurrence(utf8::utfchar32_t character); + void add(utf8::utfchar32_t character); + + std::unordered_map::iterator begin(); + std::unordered_map::iterator end(); +}; + +struct context_model +{ + void add(utf8::utfchar32_t character); + + std::unordered_map::iterator begin(); + std::unordered_map::iterator end(); + +private: + std::list current_context; + std::unordered_map occurrences; +}; -- cgit v1.2.3