| 55 | |
| 56 | template <class TTextFeature> |
| 57 | class TIterableTextFeature { |
| 58 | public: |
| 59 | TIterableTextFeature(const TTextFeature& textFeature) |
| 60 | : TextFeature(textFeature) |
| 61 | {} |
| 62 | |
| 63 | template <class F> |
| 64 | void ForEach(F&& visitor) const { |
| 65 | for (ui32 i: xrange(Size())) { |
| 66 | visitor(i, TextFeature[i]); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | template <class F> |
| 71 | void ForEach(F&& visitor, NPar::ILocalExecutor* localExecutor) const { |
| 72 | NPar::ParallelFor( |
| 73 | *localExecutor, |
| 74 | 0, |
| 75 | Size(), |
| 76 | [&](ui32 i) { visitor(i, TextFeature[i]); } |
| 77 | ); |
| 78 | } |
| 79 | |
| 80 | ui32 Size() const { |
| 81 | return TextFeature.size(); |
| 82 | } |
| 83 | |
| 84 | private: |
| 85 | const TTextFeature& TextFeature; |
| 86 | }; |
| 87 | |
| 88 | template <> |
| 89 | class TIterableTextFeature<ITypedArraySubsetPtr<TString>> { |
no outgoing calls
no test coverage detected