diff --git a/playground/main.cpp b/playground/main.cpp index 8998801..097366d 100644 --- a/playground/main.cpp +++ b/playground/main.cpp @@ -51,8 +51,7 @@ int main() auto strs_view = strs.ToSpan(); - auto view = - strs_view.map(predicate, ".").map(&ulib::string::split, "ky"); // ulib::PredMapView{ulib::PredMapView{strs, predicate, "."}, predicate, "_"}; + auto view = strs_view.map(predicate, ".").map(&ulib::string::split, "ky"); // ulib::MapView{ulib::MapView{strs, predicate, "."}, predicate, "_"}; for (auto s : view) { diff --git a/ulib/ulib/containers/list.h b/ulib/ulib/containers/list.h index 710ef0a..f2b018e 100644 --- a/ulib/ulib/containers/list.h +++ b/ulib/ulib/containers/list.h @@ -766,20 +766,20 @@ namespace ulib for (auto it = mBegin; it != mLast; it++) result.push_back(pred(*it, args...)); - return PredMapView{*this, std::forward(pred), std::forward(args)...}; + return MapView{*this, std::forward(pred), std::forward(args)...}; } */ template auto map_lazy(Pred &&pred, Args &&...args) const { - return PredMapView{*this, std::forward(pred), std::forward(args)...}; + return MapView{*this, std::forward(pred), std::forward(args)...}; } template auto map_lazy(Pred &&pred, Args &&...args) { - return PredMapView{*this, std::forward(pred), std::forward(args)...}; + return MapView{*this, std::forward(pred), std::forward(args)...}; } template diff --git a/ulib/ulib/containers/mapview.h b/ulib/ulib/containers/mapview.h index 78290fc..3171398 100644 --- a/ulib/ulib/containers/mapview.h +++ b/ulib/ulib/containers/mapview.h @@ -11,10 +11,10 @@ namespace ulib { template - class PredMapView + class MapView { public: - using SelfT = PredMapView; + using SelfT = MapView; using underlying_span_type = SpanT; using predicate_type = std::decay_t; @@ -28,7 +28,7 @@ namespace ulib struct Iterator : public BaseIterator, std::random_access_iterator_tag> { inline Iterator() {} - inline Iterator(underlying_iterator iter, const PredMapView *view) : iter(iter), view(view) {} + inline Iterator(underlying_iterator iter, const MapView *view) : iter(iter), view(view) {} static auto TupleIterHelper(underlying_value_type &obj) { return std::make_tuple(std::ref(obj)); } @@ -70,7 +70,7 @@ namespace ulib // inline T *raw() { return ptr; } underlying_iterator iter; - const PredMapView *view; + const MapView *view; }; public: @@ -79,12 +79,12 @@ namespace ulib SpanT &underlying_span() { return mSpan; } const SpanT &underlying_span() const { return mSpan; } - PredMapView(underlying_span_type span, predicate_type &&pred, Args... args) + MapView(underlying_span_type span, predicate_type &&pred, Args... args) : mSpan{span}, mPred{std::move(pred)}, mArgs{std::make_tuple...>(args...)} { } - PredMapView(underlying_span_type span, const predicate_type &pred, Args... args) + MapView(underlying_span_type span, const predicate_type &pred, Args... args) : mSpan{span}, mPred{pred}, mArgs{std::make_tuple...>(args...)} { } @@ -97,21 +97,21 @@ namespace ulib template auto map(NewPred &&pred, NewArgs &&...args) const { - return PredMapView{*this, std::forward(pred), std::forward(args)...}; + return MapView{*this, std::forward(pred), std::forward(args)...}; } template >> auto map(RetVal (VT::*fn)(FuncArgs &&...), FuncArgs &&...args) const { auto pred = [fn, ... args = std::forward(args)](VT &instance) { return ((instance).*fn)(args...); }; - return PredMapView{*this, std::move(pred)}; + return MapView{*this, std::move(pred)}; } template >> auto map(RetVal (VT::*fn)(FuncArgs &&...) const, FuncArgs &&...args) const { auto pred = [fn, ... args = std::forward(args)](const VT &instance) { return ((instance).*fn)(args...); }; - return PredMapView{*this, std::move(pred)}; + return MapView{*this, std::move(pred)}; } private: diff --git a/ulib/ulib/containers/span.h b/ulib/ulib/containers/span.h index fa1e0f9..4b8bb6c 100644 --- a/ulib/ulib/containers/span.h +++ b/ulib/ulib/containers/span.h @@ -471,7 +471,7 @@ namespace ulib template auto map(Pred &&pred, Args &&...args) { - return PredMapView{*this, std::forward(pred), std::forward(args)...}; + return MapView{*this, std::forward(pred), std::forward(args)...}; } private: