• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
2
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>Boost.Flyweight Documentation - Future work</title>
7<link rel="stylesheet" href="style.css" type="text/css">
8<link rel="start" href="examples.html">
9<link rel="prev" href="tests.html">
10<link rel="up" href="index.html">
11<link rel="next" href="release_notes.html">
12</head>
13
14<body>
15<h1><img src="../../../boost.png" alt="Boost logo" align=
16"middle" width="277" height="86">Boost.Flyweight Future work</h1>
17
18<div class="prev_link"><a href="tests.html"><img src="prev.gif" alt="examples" border="0"><br>
19Tests
20</a></div>
21<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
22Index
23</a></div>
24<div class="next_link"><a href="release_notes.html"><img src="next.gif" alt="release notes" border="0"><br>
25Release notes
26</a></div><br clear="all" style="clear: all;">
27<br clear="all" style="clear: all;">
28
29<hr>
30
31<p>
32New functionalities can be included into future releases of Boost.Flyweight
33to meet the demands of users and to leverage upcoming C++ features
34and new Boost libraries. The following is a list of candidate additions.
35</p>
36
37<h2>Contents</h2>
38
39<ul>
40  <li><a href="#instrospection">Introspection API</a></li>
41  <li><a href="#rw_lock">Read/write locking policy</a></li>
42  <li><a href="#new_boost_libs">Integration with new Boost libraries</a></li>
43</ul>
44
45<h2><a name="instrospection">Introspection API</a></h2>
46
47<p>
48Currently there is no way to access the internal components of a
49<code>flyweight</code> instantiation (factory, holder, etc.) or even
50to know the types of these components. With such an API it would be
51possible to instrument and monitor the usage of Boost.Flyweight like in
52the following example:
53</p>
54
55<blockquote><pre>
56<span class=keyword>typedef</span> <span class=identifier>flyweight</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>&gt;</span> <span class=identifier>fw_type</span><span class=special>;</span>
57<span class=special>...</span>
58<span class=identifier>std</span><span class=special>::</span><span class=identifier>cout</span><span class=special>&lt;&lt;</span><span class=string>&quot;factory used:  &quot;</span><span class=special>&lt;&lt;</span><span class=keyword>typeid</span><span class=special>(</span><span class=identifier>fw_type</span><span class=special>::</span><span class=identifier>factory_type</span><span class=special>).</span><span class=identifier>name</span><span class=special>()&lt;&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;</span>
59<span class=identifier>std</span><span class=special>::</span><span class=identifier>cout</span><span class=special>&lt;&lt;</span><span class=string>&quot;values stored: &quot;</span><span class=special>&lt;&lt;</span><span class=identifier>fw_type</span><span class=special>::</span><span class=identifier>factory</span><span class=special>().</span><span class=identifier>size</span><span class=special>()&lt;&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>endl</span><span class=special>;</span>
60</pre></blockquote>
61
62<h2><a name="rw_lock">Read/write locking policy</a></h2>
63
64<p>
65The nature of the flyweight pattern implies that most accesses
66to the internal flyweight factory do not cause new insertions and can
67thus be considered read-only. This hints at the convenience of using
68a locking policy based on read/write locks such as those provided by
69<a href="../../../doc/html/thread/synchronization.html#thread.synchronization.mutex_concepts.shared_lockable">Boost.Thread</a>.
70Implementing a locking policy will also require extending the
71<a href="reference/factories.html#factory"><code>Factory</code></a> concept
72to allow for pure lookup operations. Tim Blechmann has provided a
73preliminary <a href="http://lists.boost.org/Archives/boost/2008/07/139414.php">implementation</a>
74of this idea. Before committing to this library extension it is
75necessary to do a profiling study to determine whether read/write
76locking actually improves performance.
77</p>
78
79<h2><a name="new_boost_libs">Integration with new Boost libraries</a></h2>
80
81<p>
82Recently accepted Boost libraries like
83<a href="http://lists.boost.org/boost-announce/2007/12/0149.php">Boost.Functional/Forward</a>
84and <a href="http://lists.boost.org/boost-announce/2007/12/0157.php">Boost.Functional/Factory</a>
85might be used in the future to replace some internal machinery of
86Boost.Flyweight.
87</p>
88
89<hr>
90
91<div class="prev_link"><a href="tests.html"><img src="prev.gif" alt="examples" border="0"><br>
92Tests
93</a></div>
94<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
95Index
96</a></div>
97<div class="next_link"><a href="release_notes.html"><img src="next.gif" alt="release notes" border="0"><br>
98Release notes
99</a></div><br clear="all" style="clear: all;">
100<br clear="all" style="clear: all;">
101
102<br>
103
104<p>Revised April 24th 2019</p>
105
106<p>&copy; Copyright 2006-2019 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
107Distributed under the Boost Software
108License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
109LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
110http://www.boost.org/LICENSE_1_0.txt</a>)
111</p>
112
113</body>
114</html>
115