diff --git a/autotest/ValuePick/ValuePick.cpp b/autotest/ValuePick/ValuePick.cpp index 59bc16afd..af705b962 100644 --- a/autotest/ValuePick/ValuePick.cpp +++ b/autotest/ValuePick/ValuePick.cpp @@ -17,7 +17,7 @@ CONSOLE_APP_MAIN { Vector v; v << 5 << 1 << 3; - ValueArray va(v); + ValueArray va = pick(v); ASSERT(v.IsPicked()); TEST(va, "[5, 1, 3]"); Vector v2 = va.Pick(); @@ -48,4 +48,6 @@ CONSOLE_APP_MAIN TEST(m, "{ 2: ahoj, 1: kamarade }"); } + + LOG("============== OK"); } diff --git a/reference/ValuePick/ValuePick.cpp b/reference/ValuePick/ValuePick.cpp index 6d5e146fd..071b46a4d 100644 --- a/reference/ValuePick/ValuePick.cpp +++ b/reference/ValuePick/ValuePick.cpp @@ -4,6 +4,8 @@ using namespace Upp; CONSOLE_APP_MAIN { + StdLogSetup(LOG_COUT|LOG_FILE); + ValueArray va; va << 12 << 3 << 5 << 1 << 10; DUMP(va); diff --git a/uppsrc/Core/Index.h b/uppsrc/Core/Index.h index 3e277df6a..ed1e2d577 100644 --- a/uppsrc/Core/Index.h +++ b/uppsrc/Core/Index.h @@ -176,9 +176,9 @@ public: bool operator>(const AIndex& x) const { return Compare(x) > 0; } #endif - V PickKeys() { return pick(key); } - const V& GetKeys() const { return key; } - bool IsPicked(void) const { return key.IsPicked(); } + V PickKeys() pick_ { return pick(key); } + const V& GetKeys() const { return key; } + bool IsPicked(void) const { return key.IsPicked(); } // Pick assignment & copy. Picked source can only Clear(), ~AIndex(), operator=, operator<<= diff --git a/uppsrc/Core/Map.h b/uppsrc/Core/Map.h index 4a59a90af..35f37d14a 100644 --- a/uppsrc/Core/Map.h +++ b/uppsrc/Core/Map.h @@ -103,11 +103,11 @@ public: Index PickIndex() { return pick(key); } const Vector& GetKeys() const { return key.GetKeys(); } - Vector PickKeys() { return key.PickKeys(); } + Vector PickKeys() pick_ { return key.PickKeys(); } const V& GetValues() const { return value; } V& GetValues() { return value; } - V PickValues() { return pick(value); } + V PickValues() pick_ { return pick(value); } bool IsPicked() const { return value.IsPicked() || key.IsPicked(); } diff --git a/uppsrc/Core/ValueUtil.h b/uppsrc/Core/ValueUtil.h index 2ec87cc5f..58d21e415 100644 --- a/uppsrc/Core/ValueUtil.h +++ b/uppsrc/Core/ValueUtil.h @@ -216,12 +216,12 @@ class ValueArray : public ValueType rval_ values); + ValueArray(Vector rval_ values); explicit ValueArray(const Vector& values, int deep); ~ValueArray(); ValueArray& operator=(const ValueArray& v); - ValueArray& operator=(Vector rval_ values) { *this = ValueArray(values); return *this; } + ValueArray& operator=(Vector rval_ values) { *this = ValueArray(pick(values)); return *this; } operator Value() const; ValueArray(const Value& src); @@ -308,7 +308,7 @@ public: ~ValueMap(); ValueMap& operator=(const ValueMap& v); - ValueMap& operator=(VectorMap rval_ m) { *this = ValueMap(m); return *this; } + ValueMap& operator=(VectorMap rval_ m) { *this = ValueMap(pick(m)); return *this; } operator Value() const; ValueMap(const Value& src);