summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/property_map
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/property_map
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/property_map')
-rw-r--r--src/boost/libs/property_map/Jamfile11
-rw-r--r--src/boost/libs/property_map/LICENSE23
-rw-r--r--src/boost/libs/property_map/README.md35
-rw-r--r--src/boost/libs/property_map/example/Jamfile.v216
-rw-r--r--src/boost/libs/property_map/example/compose_property_map_example.cpp36
-rw-r--r--src/boost/libs/property_map/example/example1.cpp48
-rw-r--r--src/boost/libs/property_map/example/example2.cpp46
-rw-r--r--src/boost/libs/property_map/example/example3.cpp21
-rw-r--r--src/boost/libs/property_map/index.html13
-rw-r--r--src/boost/libs/property_map/meta/libraries.json15
-rw-r--r--src/boost/libs/property_map/test/Jamfile.v226
-rw-r--r--src/boost/libs/property_map/test/compose_property_map_test.cpp101
-rw-r--r--src/boost/libs/property_map/test/dynamic_properties_test.cpp138
-rw-r--r--src/boost/libs/property_map/test/function_property_map_test.cpp66
-rw-r--r--src/boost/libs/property_map/test/property_map_cc.cpp115
-rw-r--r--src/boost/libs/property_map/test/transform_value_property_map_test.cpp72
16 files changed, 782 insertions, 0 deletions
diff --git a/src/boost/libs/property_map/Jamfile b/src/boost/libs/property_map/Jamfile
new file mode 100644
index 000000000..fe20ff603
--- /dev/null
+++ b/src/boost/libs/property_map/Jamfile
@@ -0,0 +1,11 @@
+# Boost.PropertyMap Library Jamfile
+#
+# Copyright (c) 2018 James E. King III
+#
+# Use, modification, and distribution are subject to 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)
+
+# please order by name to ease maintenance
+build-project example ;
+build-project test ;
diff --git a/src/boost/libs/property_map/LICENSE b/src/boost/libs/property_map/LICENSE
new file mode 100644
index 000000000..36b7cd93c
--- /dev/null
+++ b/src/boost/libs/property_map/LICENSE
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/src/boost/libs/property_map/README.md b/src/boost/libs/property_map/README.md
new file mode 100644
index 000000000..0e8d2f918
--- /dev/null
+++ b/src/boost/libs/property_map/README.md
@@ -0,0 +1,35 @@
+PropertyMap, part of collection of the [Boost C++ Libraries](http://github.com/boostorg),
+defines a general purpose interface for mapping key objects to corresponding value objects, thereby hiding the details of how the mapping is implemented from algorithms.
+
+### License
+
+Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
+
+### Properties
+
+* C++03
+* Header-only
+
+### Build Status
+
+Branch | Travis | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests |
+:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- |
+[`master`](https://github.com/boostorg/property_map/tree/master) | [![Build Status](https://travis-ci.org/boostorg/property_map.svg?branch=master)](https://travis-ci.org/boostorg/property_map) | [![Build status](https://ci.appveyor.com/api/projects/status/jo7n29t5w499dodk/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/property-map-06329/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/15841/badge.svg)](https://scan.coverity.com/projects/boostorg-property_map) | [![codecov](https://codecov.io/gh/boostorg/property_map/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/property_map/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/property_map.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/property_map.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/property_map.html)
+[`develop`](https://github.com/boostorg/property_map/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/property_map.svg?branch=develop)](https://travis-ci.org/boostorg/property_map) | [![Build status](https://ci.appveyor.com/api/projects/status/jo7n29t5w499dodk/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/property-map-06329/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/15841/badge.svg)](https://scan.coverity.com/projects/boostorg-property_map) | [![codecov](https://codecov.io/gh/boostorg/property_map/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/property_map/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/property_map.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/property_map.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/property_map.html)
+
+### Directories
+
+| Name | Purpose |
+| ----------- | ------------------------------ |
+| `doc` | documentation |
+| `example` | examples |
+| `include` | headers |
+| `test` | unit tests |
+
+### More information
+
+* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-property_map)
+* [Report bugs](https://github.com/boostorg/property_map/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
+* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
+* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[property_map]` tag at the beginning of the subject line.
+
diff --git a/src/boost/libs/property_map/example/Jamfile.v2 b/src/boost/libs/property_map/example/Jamfile.v2
new file mode 100644
index 000000000..928f62a10
--- /dev/null
+++ b/src/boost/libs/property_map/example/Jamfile.v2
@@ -0,0 +1,16 @@
+# Boost.PropertyMap Library example Jamfile
+#
+# Copyright (c) 2018 James E. King III
+#
+# Distributed under the Boost Software License, Version 1.0. (See accompany-
+# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+import testing ;
+
+test-suite "property_map-examples"
+ : [ run compose_property_map_example.cpp ]
+ [ run example1.cpp ]
+ [ run example2.cpp ]
+ [ run example3.cpp ]
+ ;
+
diff --git a/src/boost/libs/property_map/example/compose_property_map_example.cpp b/src/boost/libs/property_map/example/compose_property_map_example.cpp
new file mode 100644
index 000000000..ed809632a
--- /dev/null
+++ b/src/boost/libs/property_map/example/compose_property_map_example.cpp
@@ -0,0 +1,36 @@
+// Copyright (C) 2013 Eurodecision
+// Authors: Guillaume Pinot
+//
+// 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/compose_property_map.hpp>
+#include <iostream>
+
+int main()
+{
+ const int idx[] = {2, 0, 4, 1, 3};
+ double v[] = {1., 3., 0., 4., 2.};
+ boost::compose_property_map<double*, const int*> cpm(v, idx);
+
+ for (int i = 0; i < 5; ++i)
+ std::cout << get(cpm, i) << " ";
+ std::cout << std::endl;
+
+ for (int i = 0; i < 5; ++i)
+ ++cpm[i];
+
+ for (int i = 0; i < 5; ++i)
+ std::cout << get(cpm, i) << " ";
+ std::cout << std::endl;
+
+ for (int i = 0; i < 5; ++i)
+ put(cpm, i, 42.);
+
+ for (int i = 0; i < 5; ++i)
+ std::cout << get(cpm, i) << " ";
+ std::cout << std::endl;
+
+ return 0;
+}
diff --git a/src/boost/libs/property_map/example/example1.cpp b/src/boost/libs/property_map/example/example1.cpp
new file mode 100644
index 000000000..fdaebb193
--- /dev/null
+++ b/src/boost/libs/property_map/example/example1.cpp
@@ -0,0 +1,48 @@
+// (C) Copyright Jeremy Siek 2002.
+// 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 <iostream>
+#include <map>
+#include <string>
+#include <boost/property_map/property_map.hpp>
+
+
+template <typename AddressMap>
+void foo(AddressMap address)
+{
+ typedef typename boost::property_traits<AddressMap>::value_type value_type;
+ typedef typename boost::property_traits<AddressMap>::key_type key_type;
+
+ value_type old_address, new_address;
+ key_type fred = "Fred";
+ old_address = get(address, fred);
+ new_address = "384 Fitzpatrick Street";
+ put(address, fred, new_address);
+
+ key_type joe = "Joe";
+ value_type& joes_address = address[joe];
+ joes_address = "325 Cushing Avenue";
+}
+
+int
+main()
+{
+ std::map<std::string, std::string> name2address;
+ boost::associative_property_map< std::map<std::string, std::string> >
+ address_map(name2address);
+
+ name2address.insert(make_pair(std::string("Fred"),
+ std::string("710 West 13th Street")));
+ name2address.insert(make_pair(std::string("Joe"),
+ std::string("710 West 13th Street")));
+
+ foo(address_map);
+
+ for (std::map<std::string, std::string>::iterator i = name2address.begin();
+ i != name2address.end(); ++i)
+ std::cout << i->first << ": " << i->second << "\n";
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/boost/libs/property_map/example/example2.cpp b/src/boost/libs/property_map/example/example2.cpp
new file mode 100644
index 000000000..334027235
--- /dev/null
+++ b/src/boost/libs/property_map/example/example2.cpp
@@ -0,0 +1,46 @@
+// (C) Copyright Ronald Garcia, Jeremy Siek 2002.
+// 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 <iostream>
+#include <map>
+#include <string>
+#include <boost/property_map/property_map.hpp>
+
+
+template <typename ConstAddressMap>
+void display(ConstAddressMap address)
+{
+ typedef typename boost::property_traits<ConstAddressMap>::value_type
+ value_type;
+ typedef typename boost::property_traits<ConstAddressMap>::key_type key_type;
+
+ key_type fred = "Fred";
+ key_type joe = "Joe";
+
+ value_type freds_address = get(address, fred);
+ value_type joes_address = get(address, joe);
+
+ std::cout << fred << ": " << freds_address << "\n"
+ << joe << ": " << joes_address << "\n";
+}
+
+int
+main()
+{
+ std::map<std::string, std::string> name2address;
+ boost::const_associative_property_map< std::map<std::string, std::string> >
+ address_map(name2address);
+
+ name2address.insert(make_pair(std::string("Fred"),
+ std::string("710 West 13th Street")));
+ name2address.insert(make_pair(std::string("Joe"),
+ std::string("710 West 13th Street")));
+
+ display(address_map);
+
+ return EXIT_SUCCESS;
+}
+
+
diff --git a/src/boost/libs/property_map/example/example3.cpp b/src/boost/libs/property_map/example/example3.cpp
new file mode 100644
index 000000000..2fed1beec
--- /dev/null
+++ b/src/boost/libs/property_map/example/example3.cpp
@@ -0,0 +1,21 @@
+// Copyright Vladimir Prus 2003.
+// 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/vector_property_map.hpp>
+#include <string>
+#include <iostream>
+
+int main()
+{
+ boost::vector_property_map<std::string> m;
+
+ // Assign string to '4'.
+ m[4] = "e";
+ std::cout << "'" << m[4] << "'\n";
+
+ // Grab string from '10'. Since none is associated,
+ // "" will be returned.
+ std::cout << "'" << m[10] << "'\n";
+}
diff --git a/src/boost/libs/property_map/index.html b/src/boost/libs/property_map/index.html
new file mode 100644
index 000000000..d5846e3de
--- /dev/null
+++ b/src/boost/libs/property_map/index.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="0; URL=doc/property_map.html">
+</head>
+<body>
+Automatic redirection failed, please go to
+<a href="doc/property_map.html">doc/property_map.html</a>.&nbsp;<hr>
+<p>&copy; Copyright Beman Dawes, 2001</p>
+<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
+file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
+at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
+</body>
+</html>
diff --git a/src/boost/libs/property_map/meta/libraries.json b/src/boost/libs/property_map/meta/libraries.json
new file mode 100644
index 000000000..6d96e88a3
--- /dev/null
+++ b/src/boost/libs/property_map/meta/libraries.json
@@ -0,0 +1,15 @@
+{
+ "key": "property_map",
+ "name": "Property Map",
+ "authors": [
+ "Jeremy Siek"
+ ],
+ "description": "Concepts defining interfaces which map key objects to value objects.",
+ "category": [
+ "Containers",
+ "Generic"
+ ],
+ "maintainers": [
+ "Douglas Gregor <dgregor -at- cs.indiana.edu>"
+ ]
+}
diff --git a/src/boost/libs/property_map/test/Jamfile.v2 b/src/boost/libs/property_map/test/Jamfile.v2
new file mode 100644
index 000000000..b6353d294
--- /dev/null
+++ b/src/boost/libs/property_map/test/Jamfile.v2
@@ -0,0 +1,26 @@
+# PropertyMap library
+
+# Copyright (C) 2005 Trustees of Indiana University
+#
+# Author: Douglas Gregor
+#
+# Use, modification and distribution is subject to 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)
+
+# For more information, see http://www.boost.org/
+
+import os ;
+
+project
+ : requirements
+ <target-os>cygwin:<define>_POSIX_C_SOURCE=201112L
+ ;
+
+test-suite property_map
+ : [ compile property_map_cc.cpp ]
+ [ run compose_property_map_test.cpp ]
+ [ run dynamic_properties_test.cpp ]
+ [ run function_property_map_test.cpp ]
+ [ run transform_value_property_map_test.cpp ]
+ ;
diff --git a/src/boost/libs/property_map/test/compose_property_map_test.cpp b/src/boost/libs/property_map/test/compose_property_map_test.cpp
new file mode 100644
index 000000000..7ee716682
--- /dev/null
+++ b/src/boost/libs/property_map/test/compose_property_map_test.cpp
@@ -0,0 +1,101 @@
+// Copyright (C) 2013 Eurodecision
+// Authors: Guillaume Pinot
+//
+// 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/compose_property_map.hpp>
+
+#include <boost/property_map/function_property_map.hpp>
+#include <boost/test/minimal.hpp>
+
+void concept_checks()
+{
+ using namespace boost;
+ {
+ typedef null_archetype<> Key;
+ //typedef assignable_archetype<copy_constructible_archetype<> > Value;
+ typedef copy_constructible_archetype<assignable_archetype<> > Value;
+ typedef readable_property_map_archetype<Key, Key> GPMap;
+ typedef readable_property_map_archetype<Key, Value> FPMap;
+ typedef compose_property_map<FPMap, GPMap> CPM;
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<CPM, Key>));
+ }
+ {
+ typedef null_archetype<> Key;
+ typedef copy_constructible_archetype<assignable_archetype<> > Value;
+ typedef readable_property_map_archetype<Key, Key> GPMap;
+ typedef writable_property_map_archetype<Key, Value> FPMap;
+ typedef compose_property_map<FPMap, GPMap> CPM;
+ BOOST_CONCEPT_ASSERT((WritablePropertyMapConcept<CPM, Key>));
+ }
+ {
+ typedef null_archetype<> Key;
+ typedef copy_constructible_archetype<assignable_archetype<> > Value;
+ typedef readable_property_map_archetype<Key, Key> GPMap;
+ typedef read_write_property_map_archetype<Key, Value> FPMap;
+ typedef compose_property_map<FPMap, GPMap> CPM;
+ BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept<CPM, Key>));
+ }
+ {
+ typedef null_archetype<> Key;
+ typedef copy_constructible_archetype<assignable_archetype<> > Value;
+ typedef readable_property_map_archetype<Key, Key> GPMap;
+ typedef lvalue_property_map_archetype<Key, Value> FPMap;
+ typedef compose_property_map<FPMap, GPMap> CPM;
+ BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<CPM, Key>));
+ }
+ {
+ typedef null_archetype<> Key;
+ typedef copy_constructible_archetype<assignable_archetype<> > Value;
+ typedef readable_property_map_archetype<Key, Key> GPMap;
+ typedef mutable_lvalue_property_map_archetype<Key, Value> FPMap;
+ typedef compose_property_map<FPMap, GPMap> CPM;
+ BOOST_CONCEPT_ASSERT((Mutable_LvaluePropertyMapConcept<CPM, Key>));
+ }
+}
+
+void pointer_pmap_check()
+{
+ const int idx[] = {2, 0, 4, 1, 3};
+ double v[] = {1., 3., 0., 4., 2.};
+ boost::compose_property_map<double*, const int*> cpm(v, idx);
+
+ for (int i = 0; i < 5; ++i) {
+ BOOST_CHECK(get(cpm, i) == static_cast<double>(i));
+ ++cpm[i];
+ BOOST_CHECK(cpm[i] == static_cast<double>(i + 1));
+ put(cpm, i, 42.);
+ BOOST_CHECK(cpm[i] == 42.);
+ }
+}
+
+struct modulo_add_one {
+ typedef int result_type;
+ modulo_add_one(int m): modulo(m) {}
+ int operator()(int i) const {return (i + 1) % modulo;}
+ int modulo;
+};
+
+void readable_pmap_checks()
+{
+ using namespace boost;
+ typedef function_property_map<modulo_add_one, int> modulo_add_one_pmap;
+
+ compose_property_map<modulo_add_one_pmap, modulo_add_one_pmap>
+ cpm(modulo_add_one(5), modulo_add_one(5));
+
+ for (int i = 0; i < 10; ++i)
+ BOOST_CHECK(get(cpm, i) == (i + 2) % 5);
+}
+
+int
+test_main(int, char**)
+{
+ concept_checks();
+ pointer_pmap_check();
+ readable_pmap_checks();
+
+ return 0;
+}
diff --git a/src/boost/libs/property_map/test/dynamic_properties_test.cpp b/src/boost/libs/property_map/test/dynamic_properties_test.cpp
new file mode 100644
index 000000000..813225d59
--- /dev/null
+++ b/src/boost/libs/property_map/test/dynamic_properties_test.cpp
@@ -0,0 +1,138 @@
+
+// Copyright 2005 The Trustees of Indiana University.
+
+// Use, modification and distribution is subject to 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)
+
+//
+// dynamic_properties_test.cpp - test cases for the dynamic property maps.
+//
+
+// Author: Ronald Garcia
+#include <boost/config.hpp>
+
+// For Borland, act like BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS is defined
+#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x570) && !defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS)
+# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+#endif
+
+#include <boost/test/minimal.hpp>
+#include <boost/smart_ptr.hpp>
+#include <boost/property_map/dynamic_property_map.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <map>
+#include <iostream>
+#include <string>
+#include <memory>
+
+// generate a dynamic_property_map that maps strings to strings
+// WARNING: This code leaks memory. For testing purposes only!
+// WARNING: This code uses library internals. For testing purposes only!
+boost::shared_ptr<boost::dynamic_property_map>
+string2string_gen(const std::string& name,
+ const boost::any&,
+ const boost::any&) {
+ typedef std::map<std::string,std::string> map_t;
+ typedef
+ boost::associative_property_map< std::map<std::string, std::string> >
+ property_t;
+
+
+ map_t* mymap = new map_t(); // hint: leaky memory here!
+
+ property_t property_map(*mymap);
+
+ boost::shared_ptr<boost::dynamic_property_map> pm(
+ new
+ boost::detail::dynamic_property_map_adaptor<property_t>(property_map));
+
+ return pm;
+}
+
+
+int test_main(int,char**) {
+
+ // build property maps using associative_property_map
+
+ std::map<std::string, int> string2int;
+ std::map<double,std::string> double2string;
+ boost::associative_property_map< std::map<std::string, int> >
+ int_map(string2int);
+ boost::associative_property_map< std::map<double, std::string> >
+ dbl_map(double2string);
+
+
+ // add key-value information
+ string2int["one"] = 1;
+ string2int["five"] = 5;
+
+ double2string[5.3] = "five point three";
+ double2string[3.14] = "pi";
+
+
+ // build and populate dynamic interface
+ boost::dynamic_properties properties;
+ properties.property("int",int_map);
+ properties.property("double",dbl_map);
+
+ using boost::get;
+ using boost::put;
+ using boost::type;
+ // Get tests
+ {
+ BOOST_CHECK(get("int",properties,std::string("one")) == "1");
+#ifndef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+ BOOST_CHECK(boost::get<int>("int",properties,std::string("one")) == 1);
+#endif
+ BOOST_CHECK(get("int",properties,std::string("one"), type<int>()) == 1);
+ BOOST_CHECK(get("double",properties,5.3) == "five point three");
+ }
+
+ // Put tests
+ {
+ put("int",properties,std::string("five"),6);
+ BOOST_CHECK(get("int",properties,std::string("five")) == "6");
+ put("int",properties,std::string("five"),std::string("5"));
+#ifndef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+ BOOST_CHECK(get<int>("int",properties,std::string("five")) == 5);
+#endif
+ BOOST_CHECK(get("int",properties,std::string("five"),type<int>()) == 5);
+ put("double",properties,3.14,std::string("3.14159"));
+ BOOST_CHECK(get("double",properties,3.14) == "3.14159");
+ put("double",properties,3.14,std::string("pi"));
+#ifndef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+ BOOST_CHECK(get<std::string>("double",properties,3.14) == "pi");
+#endif
+ BOOST_CHECK(get("double",properties,3.14,type<std::string>()) == "pi");
+ }
+
+ // Nonexistent property
+ {
+ try {
+ get("nope",properties,3.14);
+ BOOST_ERROR("No exception thrown.");
+ } catch (boost::dynamic_get_failure&) { }
+
+ try {
+ put("nada",properties,3.14,std::string("3.14159"));
+ BOOST_ERROR("No exception thrown.");
+ } catch (boost::property_not_found&) { }
+ }
+
+ // Nonexistent property gets generated
+ {
+ boost::dynamic_properties props(&string2string_gen);
+ put("nada",props,std::string("3.14"),std::string("pi"));
+ BOOST_CHECK(get("nada",props,std::string("3.14")) == "pi");
+ }
+
+ // Use the ignore_other_properties generator
+ {
+ boost::dynamic_properties props(&boost::ignore_other_properties);
+ bool value = put("nada",props,std::string("3.14"),std::string("pi"));
+ BOOST_CHECK(value == false);
+ }
+
+ return boost::exit_success;
+}
diff --git a/src/boost/libs/property_map/test/function_property_map_test.cpp b/src/boost/libs/property_map/test/function_property_map_test.cpp
new file mode 100644
index 000000000..8f072ec3f
--- /dev/null
+++ b/src/boost/libs/property_map/test/function_property_map_test.cpp
@@ -0,0 +1,66 @@
+//
+//=======================================================================
+// Author: Jeremiah Willcock
+//
+// Copyright 2012, Trustees of Indiana University
+//
+// 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/function_property_map.hpp>
+#include <boost/concept/assert.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/static_assert.hpp>
+
+template <typename T>
+struct add1 {typedef T result_type; T operator()(const T& x) const {return x + 1;}};
+
+template <typename T>
+struct add1_val {typedef T result_type; T operator()(T x) const {return x + 1;}};
+
+template <typename T>
+struct return_fixed_ref {
+ int* ptr;
+ return_fixed_ref(int* ptr): ptr(ptr) {}
+ typedef int& result_type;
+ int& operator()(const T&) const {return *ptr;}
+};
+
+int test_main(int, char**) {
+ using namespace boost;
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<function_property_map<add1<int>, int>, int>));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<function_property_map<add1<int>, int, double>, int>));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<function_property_map<add1_val<int>, int>, int>));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<function_property_map<add1_val<int>, int, double>, int>));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<function_property_map<return_fixed_ref<int>, int>, int>));
+ BOOST_CONCEPT_ASSERT((WritablePropertyMapConcept<function_property_map<return_fixed_ref<int>, int>, int>));
+ BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept<function_property_map<return_fixed_ref<int>, int>, int>));
+ BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<function_property_map<return_fixed_ref<int>, int>, int>));
+
+ BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<function_property_map<add1<int>, int> >::category, boost::readable_property_map_tag>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<function_property_map<add1_val<int>, int> >::category, boost::readable_property_map_tag>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<function_property_map<return_fixed_ref<int>, int> >::category, boost::lvalue_property_map_tag>::value));
+
+ BOOST_CHECK(get(function_property_map<add1<int>, int>(), 3) == 4);
+ BOOST_CHECK(get(function_property_map<add1<int>, int>(add1<int>()), 4) == 5);
+ BOOST_CHECK(get(make_function_property_map<int>(add1<int>()), 5) == 6);
+ BOOST_CHECK(get(function_property_map<add1_val<int>, int>(), 3) == 4);
+ BOOST_CHECK(get(function_property_map<add1_val<int>, int>(add1_val<int>()), 4) == 5);
+ BOOST_CHECK(get(make_function_property_map<int>(add1_val<int>()), 5) == 6);
+ int val;
+ const function_property_map<return_fixed_ref<int>, int> pm = return_fixed_ref<int>((&val));
+ put(pm, 1, 6);
+ BOOST_CHECK(get(pm, 2) == 6);
+ BOOST_CHECK((get(pm, 3) = 7) == 7);
+ BOOST_CHECK(get(pm, 4) == 7);
+ const function_property_map<return_fixed_ref<int>, int> pm2 = pm; // Check shallow copying
+ BOOST_CHECK(get(pm2, 5) == 7);
+ put(pm2, 3, 1);
+ BOOST_CHECK(get(pm, 1) == 1);
+
+ return 0;
+}
diff --git a/src/boost/libs/property_map/test/property_map_cc.cpp b/src/boost/libs/property_map/test/property_map_cc.cpp
new file mode 100644
index 000000000..82606ac7b
--- /dev/null
+++ b/src/boost/libs/property_map/test/property_map_cc.cpp
@@ -0,0 +1,115 @@
+// (C) Copyright Jeremy Siek 2001.
+// 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/property_map.hpp>
+#include <boost/property_map/shared_array_property_map.hpp>
+#include <map>
+
+// This file checks the property map concepts against the property map
+// archetypes to make sure they are consistent and that they compile.
+// This also checks all the property map classes defined in
+// property_map.hpp against the concept checking classes.
+
+int
+main()
+{
+ using namespace boost;
+ {
+ typedef null_archetype<> Key;
+ typedef assignable_archetype<copy_constructible_archetype<> > Value;
+ typedef readable_property_map_archetype<Key, Value> PMap;
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef null_archetype<> Key;
+ typedef assignable_archetype<copy_constructible_archetype<> > Value;
+ typedef writable_property_map_archetype<Key, Value> PMap;
+ BOOST_CONCEPT_ASSERT((WritablePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef null_archetype<> Key;
+ typedef assignable_archetype<copy_constructible_archetype<> > Value;
+ typedef read_write_property_map_archetype<Key, Value> PMap;
+ BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef null_archetype<> Key;
+ typedef assignable_archetype<copy_constructible_archetype<> > Value;
+ typedef lvalue_property_map_archetype<Key, Value> PMap;
+ BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef null_archetype<> Key;
+ typedef assignable_archetype<copy_constructible_archetype<> > Value;
+ typedef mutable_lvalue_property_map_archetype<Key, Value> PMap;
+ BOOST_CONCEPT_ASSERT((Mutable_LvaluePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef std::ptrdiff_t Key;
+ typedef int* PMap;
+ BOOST_CONCEPT_ASSERT((Mutable_LvaluePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef std::ptrdiff_t Key;
+ typedef const int* PMap;
+ BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef sgi_assignable_archetype<> Key; // ?
+ typedef sgi_assignable_archetype<> Value;
+ typedef random_access_iterator_archetype<Value> Iterator;
+ typedef readable_property_map_archetype<Key, std::ptrdiff_t> IndexMap;
+ typedef iterator_property_map<Iterator, IndexMap
+#ifdef BOOST_NO_STD_ITERATOR_TRAITS
+ , Value, const Value&
+#endif
+ > PMap;
+ BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef sgi_assignable_archetype<> Key;
+ typedef sgi_assignable_archetype<> Value;
+ typedef mutable_random_access_iterator_archetype<Value> Iterator;
+ typedef readable_property_map_archetype<Key, std::ptrdiff_t> IndexMap;
+ typedef iterator_property_map<Iterator, IndexMap
+#ifdef BOOST_NO_STD_ITERATOR_TRAITS
+ , Value, Value&
+#endif
+ > PMap;
+ BOOST_CONCEPT_ASSERT((Mutable_LvaluePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef sgi_assignable_archetype< less_than_comparable_archetype<> > Key;
+ typedef default_constructible_archetype< sgi_assignable_archetype<> >
+ Value;
+ typedef std::map<Key, Value> Container;
+ typedef associative_property_map<Container> PMap;
+ BOOST_CONCEPT_ASSERT((Mutable_LvaluePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef sgi_assignable_archetype< less_than_comparable_archetype<> > Key;
+ typedef default_constructible_archetype< sgi_assignable_archetype<> >
+ Value;
+ typedef std::map<Key, Value> Container;
+ typedef const_associative_property_map<Container> PMap;
+ BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<PMap, Key>));
+ }
+ {
+ typedef identity_property_map PMap;
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<PMap, int>));
+ }
+ {
+ typedef dummy_property_map PMap;
+ BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept<PMap, int>));
+ }
+ {
+ typedef sgi_assignable_archetype<> Key; // ?
+ typedef sgi_assignable_archetype<> Value;
+ typedef readable_property_map_archetype<Key, std::ptrdiff_t> IndexMap;
+ typedef shared_array_property_map<Value, IndexMap> PMap;
+ BOOST_CONCEPT_ASSERT((Mutable_LvaluePropertyMapConcept<PMap, Key>));
+ }
+ return 0;
+}
diff --git a/src/boost/libs/property_map/test/transform_value_property_map_test.cpp b/src/boost/libs/property_map/test/transform_value_property_map_test.cpp
new file mode 100644
index 000000000..d9032f447
--- /dev/null
+++ b/src/boost/libs/property_map/test/transform_value_property_map_test.cpp
@@ -0,0 +1,72 @@
+//
+//=======================================================================
+// Author: Jeremiah Willcock
+//
+// Copyright 2012, Trustees of Indiana University
+//
+// 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/function_property_map.hpp>
+#include <boost/property_map/transform_value_property_map.hpp>
+#include <boost/concept/assert.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/static_assert.hpp>
+
+// Ensure this is not default constructible
+struct times2 {typedef int result_type; times2(int) {}; int operator()(int x) const {return 2 * x;}};
+
+template <typename T>
+struct add1 {typedef T result_type; T operator()(const T& x) const {return x + 1;}};
+
+template <typename T>
+struct add1_val {typedef T result_type; T operator()(T x) const {return x + 1;}};
+
+template <typename T>
+struct return_fixed_ref {
+ int* ptr;
+ return_fixed_ref(int* ptr): ptr(ptr) {}
+ typedef int& result_type;
+ int& operator()(const T&) const {return *ptr;}
+};
+
+int test_main(int, char**) {
+ using namespace boost;
+ typedef function_property_map<times2, int> PM;
+ PM orig_pm(times2(0));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<add1<int>, PM>, int>));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<add1<int>, PM, double>, int>));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<add1_val<int>, PM>, int>));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<add1_val<int>, PM, double>, int>));
+ BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<transform_value_property_map<return_fixed_ref<int>, PM>, int>));
+ BOOST_CONCEPT_ASSERT((WritablePropertyMapConcept<transform_value_property_map<return_fixed_ref<int>, PM>, int>));
+ BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept<transform_value_property_map<return_fixed_ref<int>, PM>, int>));
+ BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<transform_value_property_map<return_fixed_ref<int>, PM>, int>));
+
+ BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<transform_value_property_map<add1<int>, PM> >::category, boost::readable_property_map_tag>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<transform_value_property_map<add1_val<int>, PM> >::category, boost::readable_property_map_tag>::value));
+ BOOST_STATIC_ASSERT((boost::is_same<boost::property_traits<transform_value_property_map<return_fixed_ref<int>, PM> >::category, boost::lvalue_property_map_tag>::value));
+
+ BOOST_CHECK(get(transform_value_property_map<add1<int>, PM>(add1<int>(), orig_pm), 3) == 7);
+ BOOST_CHECK(get(transform_value_property_map<add1<int>, PM>(add1<int>(), orig_pm), 4) == 9);
+ BOOST_CHECK(get(make_transform_value_property_map(add1<int>(), orig_pm), 5) == 11);
+ BOOST_CHECK(get(transform_value_property_map<add1_val<int>, PM>(add1_val<int>(), orig_pm), 3) == 7);
+ BOOST_CHECK(get(transform_value_property_map<add1_val<int>, PM>(add1_val<int>(), orig_pm), 4) == 9);
+ BOOST_CHECK(get(make_transform_value_property_map<int>(add1_val<int>(), orig_pm), 5) == 11);
+ int val;
+ const transform_value_property_map<return_fixed_ref<int>, PM> pm(return_fixed_ref<int>((&val)), orig_pm);
+ put(pm, 1, 6);
+ BOOST_CHECK(get(pm, 2) == 6);
+ BOOST_CHECK((get(pm, 3) = 7) == 7);
+ BOOST_CHECK(get(pm, 4) == 7);
+ const transform_value_property_map<return_fixed_ref<int>, PM> pm2 = pm; // Check shallow copying
+ BOOST_CHECK(get(pm2, 5) == 7);
+ put(pm2, 3, 1);
+ BOOST_CHECK(get(pm, 1) == 1);
+
+ return 0;
+}