diff --git a/include/value.h b/include/value.h index 5f387be7..85935ec5 100644 --- a/include/value.h +++ b/include/value.h @@ -476,6 +476,40 @@ class Value : private HashParent return result; } + /** + * Convert the object to a set + * + * This only works for regular arrays that are indexed by a number, start + * with position 0 and have no empty spaces. + * + * return std::vector + */ + template + std::set setValue() const + { + // only works for arrays, other types return an empty set + if (!isArray()) return std::set(); + + // allocate a result + std::set result; + + // how many elements are we inserting + size_t count = size(); + + // and fill the result set + for (size_t i = 0; i(); } + /** + * Convert the object to a set + * @return std::set + */ + template + operator std::set() const + { + return setValue(); + } + /** * Convert the object to a map with string index and Php::Value value * @return std::map