Improved coding style of recent changes by Charlie Vaske
[libdai.git] / include / dai / properties.h
index 8db7907..4e661dc 100644 (file)
@@ -146,18 +146,8 @@ class PropertySet : private std::map<PropertyKey, PropertyValue> {
         }
 
         /// Shorthand for (temporarily) adding properties, e.g. PropertySet p()("method","BP")("verbose",1)("tol",1e-9)
-               PropertySet operator()(const PropertyKey &key, const PropertyValue &val) const { PropertySet copy = *this; return copy.Set(key,val); }
+        PropertySet operator()(const PropertyKey &key, const PropertyValue &val) const { PropertySet copy = *this; return copy.Set(key,val); }
                
-               std::vector< PropertyKey > keys() const {
-                       std::vector< PropertyKey > result;
-                       result.reserve(size());
-                       PropertySet::const_iterator i = begin();
-                       for ( ; i != end(); ++i) {
-                               result.push_back(i->first);
-                       }
-                       return result;
-               }
-
         /// Check if a property with the given key exists
         bool hasKey(const PropertyKey &key) const { PropertySet::const_iterator x = find(key); return (x != this->end()); }
 
@@ -170,6 +160,15 @@ class PropertySet : private std::map<PropertyKey, PropertyValue> {
             return res;
         }
 
+        /// Returns a vector containing all keys
+        std::vector<PropertyKey> keys() const {
+            std::vector<PropertyKey> result;
+            result.reserve( size() );
+            for( PropertySet::const_iterator i = begin(); i != end(); ++i )
+                result.push_back( i->first );
+            return result;
+        }
+
         /// Writes a PropertySet object to an output stream
         friend std::ostream& operator<< (std::ostream & os, const PropertySet & ps);