Boost logo

Boost-Commit :

From: asutton_at_[hidden]
Date: 2008-07-07 08:29:07


Author: asutton
Date: 2008-07-07 08:29:07 EDT (Mon, 07 Jul 2008)
New Revision: 47182
URL: http://svn.boost.org/trac/boost/changeset/47182

Log:
Added missing file.

Added:
   sandbox/SOC/2008/graphs/trunk/boost/graphs/utility.hpp (contents, props changed)

Added: sandbox/SOC/2008/graphs/trunk/boost/graphs/utility.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/utility.hpp 2008-07-07 08:29:07 EDT (Mon, 07 Jul 2008)
@@ -0,0 +1,54 @@
+
+#ifndef UTILITY_HPP
+#define UTILITY_HPP
+
+/**
+ * @internal
+ * A forwarding comparator for proeprties objects that forwards the comparison
+ * to the configured comparator. This type is used internally to forward comparisons of vertices
+ * to the property comparison provided by the edge set parameter.
+ * @param Vertex The type of vertex being compared
+ * @param Compare An ordering over vertex properties.
+ */
+template <typename Compare>
+struct property_comparator
+{
+ inline property_comparator()
+ : comp(Compare())
+ { }
+
+ template <typename Object>
+ inline bool operator()(Object const& a, Object const& b) const
+ { return comp(a.properties(), b.properties()); }
+
+ Compare comp;
+};
+
+/**
+ * @internal
+ * A functor that returns true when we can find a propertied object with the
+ * same value as those given in the cosntructor. This works for both vertices
+ * and edges.
+ * @param Properties The type of properties being compared.
+ */
+template <typename Properties>
+struct property_finder
+{
+ inline property_finder(Properties const& p)
+ : props(p)
+ { }
+
+ template <typename Object>
+ inline bool operator()(Object const& o) const
+ { return o.properties() == props; }
+
+ Properties const& props;
+};
+
+template <typename Properties>
+inline property_finder<Properties>
+find_properties(Properties const& props)
+{ return property_finder<Properties>(props); }
+
+
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk