diff --git a/libwccl/variables.h b/libwccl/variables.h index 107d36b2521dfef0be71f4cc5fd1c59df00a8d95..c48997400656ec2555c847adcf6a833c7330cfd1 100644 --- a/libwccl/variables.h +++ b/libwccl/variables.h @@ -108,9 +108,10 @@ protected: * @todo the above is not the case yet. * * Objects of the accesor class can only be created by the Variables object, - * are valid only for that Variables object and might stop working if the - * Variables object is touched in the wrong way in between the creation and use - * of a VariableAccesor. UB is meant by "stop working". + * are valid only for that Variables object and its copies, and might stop + * working if the Variables object is touched in the wrong way in between the + * creation and use of a VariableAccesor. UB is meant by "stop working". + * Bad touch is not yet fully defined, removing a variable certainly is one. */ template<typename T> class VariableAccesor : public BaseAccesor @@ -212,8 +213,8 @@ public: /** Get a variable using a "fast" accesor. * * The accesor is required to have been created by this particular object, - * and the Variables object must have not had variables removed, however - * adding new variables should not invalidate VariableAccesor objects. + * or a copy (either way), and the Variables object must have not had + * variables removed (adding new variables should not invalidate accesors). * * If the VariableAccesor comes form a different Variables object or there * have been invalidating changes to this Variables object, behavior is not diff --git a/tests/varaccess.cpp b/tests/varaccess.cpp index 663c60d7f254db5e740fffeff87506d6114b50e7..b10e781f599af0fbd22b55a7a006a0f2fa71e2d3 100644 --- a/tests/varaccess.cpp +++ b/tests/varaccess.cpp @@ -14,12 +14,14 @@ struct VAfx { Variables v; VAfx() { - v.put("a", new Bool(true)); - v.put("b", new Bool(true)); - v.put("c", new Bool(true)); - v.put("bb", new Bool(true)); - v.put("aa", new Position(1)); - v.put("aaa", new Position(2)); + Variables v2; + v2.put("a", new Bool(true)); + v2.put("b", new Bool(true)); + v2.put("c", new Bool(true)); + v2.put("bb", new Bool(true)); + v2.put("aa", new Position(1)); + v2.put("aaa", new Position(2)); + v = v2; } };