Boost logo

Boost-Commit :

From: asutton_at_[hidden]
Date: 2007-09-06 09:59:21


Author: asutton
Date: 2007-09-06 09:59:20 EDT (Thu, 06 Sep 2007)
New Revision: 39138
URL: http://svn.boost.org/trac/boost/changeset/39138

Log:
Added a bunch of other compile tests

Added:
   sandbox/graph-v2/libs/property_map/test/compile/associative_property_map.cpp (contents, props changed)
   sandbox/graph-v2/libs/property_map/test/compile/constant_property_map.cpp (contents, props changed)
   sandbox/graph-v2/libs/property_map/test/compile/dummy_property_map.cpp (contents, props changed)
   sandbox/graph-v2/libs/property_map/test/compile/dynamic_property_map.cpp (contents, props changed)
   sandbox/graph-v2/libs/property_map/test/compile/identity_property_map.cpp (contents, props changed)
   sandbox/graph-v2/libs/property_map/test/compile/iterator_property_map.cpp (contents, props changed)
   sandbox/graph-v2/libs/property_map/test/compile/reference_property_map.cpp (contents, props changed)

Added: sandbox/graph-v2/libs/property_map/test/compile/associative_property_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/libs/property_map/test/compile/associative_property_map.cpp 2007-09-06 09:59:20 EDT (Thu, 06 Sep 2007)
@@ -0,0 +1,32 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <map>
+#include <boost/property_map/archetypes.hpp>
+#include <boost/property_map/associative_property_map.hpp>
+
+int main()
+{
+ using namespace std;
+ using namespace boost;
+ using namespace boost::property_map;
+
+ typedef unsigned Key;
+ typedef unsigned Value;
+ typedef map<Key, Value> Map;
+ typedef associative_property_map<Map> AssociativeMap;
+
+ Key& k = static_object<Key>::get();
+ Value& v = static_object<Value>::get();
+ Map m;
+ AssociativeMap amap = make_associative_property_map(m);
+
+ get(amap, k);
+ put(amap, k, v);
+ amap[k];
+
+ return 0;
+}

Added: sandbox/graph-v2/libs/property_map/test/compile/constant_property_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/libs/property_map/test/compile/constant_property_map.cpp 2007-09-06 09:59:20 EDT (Thu, 06 Sep 2007)
@@ -0,0 +1,26 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/property_map/archetypes.hpp>
+#include <boost/property_map/constant_property_map.hpp>
+
+int main()
+{
+ using namespace std;
+ using namespace boost;
+ using namespace boost::property_map;
+
+ typedef null_archetype<> Key;
+ typedef assignable_archetype< copy_constructible_archetype<> > Value;
+ typedef constant_property_map<Key, Value> ReferenceMap;
+
+ Key& k = static_object<Key>::get();
+ Value& v = static_object<Value>::get();
+ ReferenceMap rmap = make_constant_property_map<Key>(v);
+ get(rmap, k);
+
+ return 0;
+}

Added: sandbox/graph-v2/libs/property_map/test/compile/dummy_property_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/libs/property_map/test/compile/dummy_property_map.cpp 2007-09-06 09:59:20 EDT (Thu, 06 Sep 2007)
@@ -0,0 +1,26 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/property_map/archetypes.hpp>
+#include <boost/property_map/dummy_property_map.hpp>
+
+int main()
+{
+ using namespace std;
+ using namespace boost;
+ using namespace boost::property_map;
+
+ typedef null_archetype<> Key;
+ typedef assignable_archetype< copy_constructible_archetype<> > Value;
+ typedef dummy_property_map<Key, Value> DummyMap;
+
+ Key& k = static_object<Key>::get();
+ Value& v = static_object<Value>::get();
+ DummyMap dmap;
+ put(dmap, k, v);
+
+ return 0;
+}

Added: sandbox/graph-v2/libs/property_map/test/compile/dynamic_property_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/libs/property_map/test/compile/dynamic_property_map.cpp 2007-09-06 09:59:20 EDT (Thu, 06 Sep 2007)
@@ -0,0 +1,37 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <string>
+#include <boost/property_map/archetypes.hpp>
+#include <boost/property_map/constant_property_map.hpp>
+#include <boost/property_map/reference_property_map.hpp>
+#include <boost/property_map/dynamic_property_map.hpp>
+
+int main()
+{
+ using namespace std;
+ using namespace boost;
+ using namespace boost::property_map;
+
+ // TODO: Apparently, archetypes won't work in this context since the key
+ // and value types _must_ be streamable.
+ typedef unsigned Key;
+ typedef unsigned Value;
+
+ // construct a couple different property maps
+ Key& k = static_object<Key>::get();
+ Value& v = static_object<Value>::get();
+ constant_property_map<Key, Value> cmap(v);
+ reference_property_map<Key, Value> rmap(v);
+
+ dynamic_properties dp;
+ dp.property("constant", cmap);
+ dp.property("reference", rmap);
+ v = get("reference", dp, k, type<Value>());
+ v = get("constant", dp, k, type<Value>());
+
+ return 0;
+}

Added: sandbox/graph-v2/libs/property_map/test/compile/identity_property_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/libs/property_map/test/compile/identity_property_map.cpp 2007-09-06 09:59:20 EDT (Thu, 06 Sep 2007)
@@ -0,0 +1,25 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/property_map/archetypes.hpp>
+#include <boost/property_map/identity_property_map.hpp>
+
+int main()
+{
+ using namespace std;
+ using namespace boost;
+ using namespace boost::property_map;
+
+ typedef null_archetype<> Key;
+ typedef identity_property_map<Key> IdentityMap;
+
+ Key& k = static_object<Key>::get();
+ IdentityMap imap;
+ get(imap, k);
+ imap[k];
+
+ return 0;
+}

Added: sandbox/graph-v2/libs/property_map/test/compile/iterator_property_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/libs/property_map/test/compile/iterator_property_map.cpp 2007-09-06 09:59:20 EDT (Thu, 06 Sep 2007)
@@ -0,0 +1,41 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <vector>
+#include <boost/property_map/archetypes.hpp>
+#include <boost/property_map/iterator_property_map.hpp>
+
+int main()
+{
+ using namespace std;
+ using namespace boost;
+ using namespace boost::property_map;
+
+ // Use this for the index map for now...
+ // TODO: The requirements for iterator property maps are not fully
+ // defined. I'm not sure what exactly they are, but apparently the
+ // value type does not work as copy constructible and assignable.
+ // It has something to do with the fact that the key type of the
+ // index map has to be addable to the iterator type of the underling
+ // vector. Bizarre.
+ typedef null_archetype<> Key;
+ typedef unsigned Value;
+ typedef vector<Value> Vector;
+ typedef readable_property_map_archetype<Key, Value> IndexMap;
+ typedef iterator_property_map<Vector::iterator, IndexMap> IteratorMap;
+
+ Key& k = static_object<Key>::get();
+ Value& v = static_object<Value>::get();
+ Vector vec;
+ IndexMap& indices = static_object<IndexMap>::get();
+ IteratorMap imap = make_iterator_property_map(vec.begin(), indices);
+
+ get(imap, k);
+ put(imap, k, v);
+ imap[k];
+
+ return 0;
+}

Added: sandbox/graph-v2/libs/property_map/test/compile/reference_property_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-v2/libs/property_map/test/compile/reference_property_map.cpp 2007-09-06 09:59:20 EDT (Thu, 06 Sep 2007)
@@ -0,0 +1,29 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/property_map/archetypes.hpp>
+#include <boost/property_map/reference_property_map.hpp>
+
+int main()
+{
+ using namespace std;
+ using namespace boost;
+ using namespace boost::property_map;
+
+ typedef null_archetype<> Key;
+ typedef assignable_archetype< copy_constructible_archetype<> > Value;
+ typedef reference_property_map<Key, Value> ReferenceMap;
+
+ Key& k = static_object<Key>::get();
+ Value& v = static_object<Value>::get();
+ ReferenceMap rmap = make_reference_property_map<Key>(v);
+ get(rmap, k);
+ put(rmap, k, v);
+ rmap[k];
+ rmap[k] = v;
+
+ return 0;
+}


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