mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
Spirit miniboost update.
[SVN r30504]
This commit is contained in:
206
change_log.html
Normal file
206
change_log.html
Normal file
@@ -0,0 +1,206 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Spirit Change Log</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" href="doc/theme/style.css" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Spirit Change Log</h2>
|
||||
<h2>1.8.3</h2>
|
||||
<ul>
|
||||
<li>Config correction for Sun C++ by
|
||||
|
||||
|
||||
Steve Clamage (see <a href="https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1220782&group_id=7586">this link</a>). </li>
|
||||
<li>Fixed multi_pass_iterator for 64 platforms, where sizeof(int) != sizeof(ptr_type).Fixed bug that prevents the use of closures with grammars with multiple entry points, <a href="http://article.gmane.org/gmane.comp.parsers.spirit.general/8868">reported by David Pierre</a></li>
|
||||
<li>Fixed bug that prevented embedding of grammars with multiple entry points, <a href="http://article.gmane.org/gmane.comp.parsers.spirit.general/8860">reported by David Pierre</a></li>
|
||||
<li>Added '\0' to the set of valid escaped characters for escape_ch_p.</li>
|
||||
<li>Fixed a switch_p bug when used with a phoenix::actor as the conditional expression.</li>
|
||||
<li>__LINE__ macro now gets expanded in BOOST_SPIRIT_ASSERT_EXCEPTION</li>
|
||||
<li>Fixed a bug in the intersection parser <a href="http://article.gmane.org/gmane.comp.parsers.spirit.general/8544">reported by Yusaku Sugai</a></li>
|
||||
<li>The symbol parser uses the null character internally. Checks were added so that:
|
||||
<ul>
|
||||
<li>tst.add asserts if string contains the null character</li>
|
||||
<li>tst.find doesn't match null characters in the input</li>
|
||||
</ul></li>
|
||||
<li>Fixed match_attr_traits.ipp to allow non-POD to pass through. The previous version taking in the ellipsis "..." does not allow PODs to pass through.</li>
|
||||
<li>Allow evaluation to int as condition to if_p parser.</li>
|
||||
<li>Applied performance improvement changes to the PT/AST code as suggested by Stefan Slapeta. </li>
|
||||
<li>Fixed several problems with AST tree node directives (inner_node_d[], discard_first_node[], discard_last_node[] and infix_node_d[]). </li>
|
||||
</ul>
|
||||
<h2>1.8.2</h2>
|
||||
<p>Maintenance release (almost the same as 1.8.1 plus a few fixes here and there)</p>
|
||||
<ul>
|
||||
<li>Added specializations to str_p and ch_p to allow str_p('c') and ch_p("c") thus fixing some non-bugs</li>
|
||||
<li>Fixed bug where a match<T> is a variant.</li>
|
||||
<li>added Jamfile/Jamrules from CVS to spirit-1.8.1/</li>
|
||||
<li>added boost-build.jam from boost to spirit-1.8.1/</li>
|
||||
<li>disabled template multi-threading in libs/spirit/test/Jamfile</li>
|
||||
<li>added a boost-header-include rule (from spirit-header-include) pointing to miniboost in libs/spirit/test/Jamfile</li>
|
||||
<li>Fixed if_p inconsistency</li>
|
||||
</ul>
|
||||
<h2>1.6.2</h2>
|
||||
<p>The Spirit 1.6.2 release is a bug-fix release only, no new features were introduced.</p>
|
||||
<ul>
|
||||
<li>wchar_t friendly implementation of graph_p</li>
|
||||
<li>Modified escape_char_parser::parse() to use a static parser instead of a rule. This will make it more friendly to use in trees. It should also be a little more efficient.</li>
|
||||
<li>Moved to
|
||||
|
||||
|
||||
Boost Software license 1.0. </li>
|
||||
<li> workaround for Error 322 name lookup in base class specialization finds type</li>
|
||||
<li> fixed limit_d bug</li>
|
||||
<li> [numerics] Workaround for aC++</li>
|
||||
<li> Fixed a bug in the switch_p parser.</li>
|
||||
<li> Fixed a EOI problem in multi_pass</li>
|
||||
<li>added Jamfile/Jamrules from CVS to spirit-1.6.1/</li>
|
||||
<li>added boost-build.jam from boost to spirit-1.6.1/</li>
|
||||
<li>disabled template multi-threading in libs/spirit/test/Jamfile</li>
|
||||
<li>added a boost-header-include rule (from spirit-header-include) pointing to miniboost in libs/spirit/test/Jamfile</li>
|
||||
</ul>
|
||||
<h2>1.8.1 (Released with Boost 1.32.0)</h2>
|
||||
<p>The Spirit 1.8.1 release is a bug-fix release only, no new features were introduced.</p>
|
||||
<ul>
|
||||
<li>Spirit now requires at least Boost 1.32.0 to compile correctly</li>
|
||||
<li>Removed the support for the older iterator adaptor library and </li>
|
||||
<li>Moved to use the new MPL library</li>
|
||||
<li>Spirit was moved to use the Boost Software License 1.0.</li>
|
||||
<li>Fixed several parsers to support post-skips more correctly.</li>
|
||||
<li>Fixed a no_node_d[] bug.</li>
|
||||
<li>Fixed a bug in shortest_d[].</li>
|
||||
<li>Fixed a bug in limit_d[].</li>
|
||||
<li>Fixed parser traversal meta code.</li>
|
||||
<li>Fixed several bugs in switch_p.</li>
|
||||
<li>Fixed AST generating problems, in particular with the loops related parsers.</li>
|
||||
<li>Fixed several bugs in the multi_pass iterator.
|
||||
<ul>
|
||||
<li>Fixed a problem, when the used base iterator returned a value_type and not a reference from its dereferencing operator.</li>
|
||||
<li>Fixed iterator_traits problem</li>
|
||||
<li>Fixed an EOI problem</li>
|
||||
<li>Fixed a bug, when used with std::cin</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Found a bug in grammar.ipp when BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE is defined</li>
|
||||
<li>Rewritten safe_bool to use CRTP - now works also on MWCW, fixed several bugs with the implementation.</li>
|
||||
<li>Fixed and extended the debug diagnostics printed by the parse tree code.</li>
|
||||
</ul>
|
||||
<h2>1.8.0 (Released with Boost 1.31.0; Includes unreleased 1.7.1)</h2>
|
||||
<ul>
|
||||
<li>Fixed a wchar_t problem in the regex_p parser.</li>
|
||||
<li>removed code and workarounds for old compilers (VC6/7 and Borland)</li>
|
||||
<li> Changed license to the new boost license.</li>
|
||||
<li> Modified escape_char_parser::parse() to use a static parser instead of a rule. This will make it more friendly to use in trees. It should also be a little more efficient.</li>
|
||||
</ul>
|
||||
<h2>1.7.1 (Unreleased; becomes 1.8.0)</h2>
|
||||
<ul>
|
||||
<li>Added a full suite of predefined actors.</li>
|
||||
<li>Moved rule_alias and stored_rule from core/non-terminal to dynamic.<br>
|
||||
Made as_parser a public API in meta/as_parser.hpp</li>
|
||||
<li>Separated Core.Meta into its own module</li>
|
||||
<li>Refactored Utility module<br>
|
||||
Moved some files into Utility.Parsers</li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>utilities
|
||||
<ul>
|
||||
<li>parsers
|
||||
<ul>
|
||||
<li>chset, regex, escape_char<br>
|
||||
confix, list, distinct<br>
|
||||
functor_parser</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li> support
|
||||
<ul>
|
||||
<li>scoped_lock<br>
|
||||
flush_multi_pass<br>
|
||||
grammar_def</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li> actors
|
||||
<ul>
|
||||
<li>assign</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<ul>
|
||||
<li>Stored rules</li>
|
||||
<li>Added the switch_p and select_p dynamic parsers.</li>
|
||||
<li>Multiple scanner support for rules.</li>
|
||||
<li>The Rule's Scanner, Context and Tag template parameters can be specified in any order now. If a template parameter is missing, it will assume the defaults. See test/rule_tests.cpp.</li>
|
||||
<li>Introduced the possibility to specify more than one start rule from a grammar.</li>
|
||||
<li>Added an implementation of the file_iterator iterator based on the new Boost iterator_adaptors (submitted originally by Thomas Witt).</li>
|
||||
</ul>
|
||||
<p><em> [The transition to the new iterator_adaptors should be complete now.]</em></p>
|
||||
<ul>
|
||||
<li>Added an implementation of the fixed_size_queue iterator based on the new Boost iterator_adaptors.</li>
|
||||
<li> wchar_t friendly implementation of graph_p</li>
|
||||
<li>made the copy-constructor and assignment-operator of parser_error_base public to clear VC7.1 C4673 warning. Added copy-constructor and assignment operator to parser_error for clarity of intent.</li>
|
||||
</ul>
|
||||
<h2>1.7.0</h2>
|
||||
<ul>
|
||||
<li> assign(string) semantic action now works in VC6</li>
|
||||
<li>parsers need not be default constructible </li>
|
||||
<li>simplified aggregation of binary and unary parsers (more compiler friendly)</li>
|
||||
<li>epsilon workarounds for VC++</li>
|
||||
<li>match's attribute now uses boost.optional</li>
|
||||
<li>subrules can now have closures</li>
|
||||
<li>project wide 64 bit compatibility</li>
|
||||
<li>dynamic_parser_tag, reissue of rule.set_id(id);</li>
|
||||
<li>numerous primitives improvements and workarounds for problematic compilers</li>
|
||||
<li>proper complement (~) of single char parser primitives and chsets</li>
|
||||
<li>intuitive handling of lexeme_d </li>
|
||||
<li>wide_phrase_scanner_t typedef</li>
|
||||
<li>dynamic parser improvements (better support for more compilers)</li>
|
||||
<li>complete rewrite of the file_iterator (using boost.iterator_adapters). Supports
|
||||
memory maps wherever available</li>
|
||||
<li>multi_pass updates (compatibility with more compilers (e.g VC7) and more)</li>
|
||||
<li>position_iterator improvements</li>
|
||||
<li>better phoenix support for more compilers</li>
|
||||
<li>phoenix new_(...) construct</li>
|
||||
<li>new lazy_p parser</li>
|
||||
<li>utility.distinct parser (undocumented)</li>
|
||||
<li>chset operators improvements </li>
|
||||
<li>confix_p streamlining and improvements</li>
|
||||
<li>numerous Boost integration improvements</li>
|
||||
</ul>
|
||||
<h2>Bug fixes (1.7.0 and 1.6.0)</h2>
|
||||
<ul>
|
||||
<li> Fixed. Using MSVC++6 (SP5), calling the assign action with a string value
|
||||
on parsers using the file_iterator will not work. </li>
|
||||
<li> Fixed: using assign semantic action in a grammar with a multi_pass iterator
|
||||
adaptor applied to an std::istream_iterator resulted in a failure to compile
|
||||
under msvc 7.0. </li>
|
||||
<li> Fixed: There is a bug in the "range_run<CharT>::set (range<CharT>
|
||||
const& r)" function in the "boost\spirit\utility\impl\chset\range_run.ipp".
|
||||
</li>
|
||||
<li> Fixed: handling of trailing whitespace bug (ast_parse/pt_parse related)</li>
|
||||
<li> Fixed: comment_p and end of data bug</li>
|
||||
<li> Fixed: <a href="http://article.gmane.org/gmane.comp.parsers.spirit.general/4029">Most
|
||||
trailing space bug</a>:</li>
|
||||
<li> Fixed:<br>
|
||||
chset<>::operator~(range<>) bug<br>
|
||||
operator&(chset<>, range<>) bug<br>
|
||||
operator&(range<>, chset<>) bug</li>
|
||||
<li> Fixed: <a href="http://sourceforge.net/mailarchive/forum.php?thread_id=2008510&forum_id=25901">impl::detach_clear
|
||||
bug</a></li>
|
||||
<li> Fixed: <a href="http://article.gmane.org/gmane.comp.parsers.spirit.general/3678">mismatch
|
||||
closure return type bug</a></li>
|
||||
<li> Fixed: <a href="http://sf.net/mailarchive/forum.php?thread_id=1963157&forum_id=1595">access_node_d[]</a>
|
||||
and <a href="http://sf.net/mailarchive/forum.php?thread_id=1966224&forum_id=1595">access_match_d[]</a>
|
||||
iterator bugs</li>
|
||||
<li> Fixed a bug regarding threadsafety of Phoenix/Spirit closures.</li>
|
||||
<li> Added missing include files to miniboost</li>
|
||||
</ul>
|
||||
<p> <font size="2" color="#666666">Copyright © 1998-2005 Joel de Guzman, Hartmut Kaiser</font><br>
|
||||
<font size="2"><font color="#666666">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) </font> </font></p>
|
||||
<p> </p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -60,7 +60,7 @@
|
||||
<tr>
|
||||
<td class="note_box"><img src="theme/alert.gif" width="16" height="16"> <strong>Closures</strong>
|
||||
<strong>and Phoenix</strong><br> <br>
|
||||
Spirit v1.8.0 closure support requires <a href="../phoenix/index.html">Phoenix</a>.
|
||||
Spirit v1.8 closure support requires <a href="../phoenix/index.html">Phoenix</a>.
|
||||
In the future, Spirit will fully support <a href="../../../libs/lambda/index.html">BLL</a>.
|
||||
Currently, work is underway to merge the features of both libraries.</td>
|
||||
</tr>
|
||||
|
||||
@@ -71,8 +71,8 @@
|
||||
arguments to the parse functions</strong>. Keep in mind that this happens only
|
||||
with rules. The rule is the only parser that has to be tied to a particular
|
||||
scanner type. For instance:</p>
|
||||
<pre><span class=comment> </span><span class=identifier>parse</span><span class=special>(</span><span class=string>"hello world"</span><span class=special>, *</span><span class=identifier>anychar_p</span><span class=special>); </span><span class=comment><code><font color="#000000"><span class=comment>// OK [character level parsing</span></font></code>]
|
||||
</span><span class=identifier>parse</span><span class=special>(</span><span class=string>"hello world"</span><span class=special>, *</span><span class=identifier>anychar_p</span><span class=special>, </span><span class=identifier>space_p</span><span class=special>); </span><span class="comment">// OK [phrase level parsing</span></pre>
|
||||
<pre><span class=comment> </span><span class=identifier>parse</span><span class=special>(</span><span class=string>"hello world"</span><span class=special>, *</span><span class=identifier>anychar_p</span><span class=special>); </span><span class=comment><code><font color="#000000"><span class=comment>// OK [character level parsing]</span></font></code>
|
||||
</span><span class=identifier>parse</span><span class=special>(</span><span class=string>"hello world"</span><span class=special>, *</span><span class=identifier>anychar_p</span><span class=special>, </span><span class=identifier>space_p</span><span class=special>); </span><span class="comment">// OK [phrase level parsing]</span></pre>
|
||||
<table width="80%" border="0" align="center">
|
||||
<tr>
|
||||
<td class="note_box"> <strong><img src="theme/note.gif" width="16" height="16">
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<p>Spirit is designed to be header only. Generally, there are no libraries to build
|
||||
and link against. Certain features, however, require additional libraries; in particular
|
||||
the <a href="regular_expression_parser.html">regular expression parser</a> requires
|
||||
<a href="http://www.boost.org/libs/regex/index.htm">Boost.Regex</a> and <a href="grammar.html#multithreading">multithreading support</a>
|
||||
<a href="http://www.boost.org/libs/regex/index.html">Boost.Regex</a> and <a href="grammar.html#multithreading">multithreading support</a>
|
||||
requires <a href="http://www.boost.org/libs/thread/doc/index.html">Boost.Threads.</a></p>
|
||||
<p>Using Spirit is as easy as including the main header file:</p>
|
||||
<pre> <span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">.</span>hpp<span class="special">></span></pre>
|
||||
@@ -87,12 +87,13 @@ requires <a href="http://www.boost.org/libs/thread/doc/index.html">Boost.Threads
|
||||
<pre> <span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">chset</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">> <br></span> <span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">chset_operators</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">><br> </span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">confix</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">distinct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">escape_char</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">flush_multi_pass</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">functor_parser</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">lists</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">loops</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">regex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">flush_multi_pass</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">> <br></span> <span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">scoped_lock</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span> <span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">distinct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></pre>
|
||||
</span><span class="preprocessor">#include</span> <span class="special"><</span>boost<span class="special">/</span>spirit<span class="special">/</span><span class="identifier">utility</span><span class="special">/</span><span class="identifier">scoped_lock</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">>
|
||||
</span></pre>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td width="10"></td>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
to lesser able compilers; hopefully, fueled by contributions from the community.
|
||||
We welcome active support from the C++ community, especially those with special
|
||||
expertise on compilers such as older Borland and MSVC++ compilers.</p>
|
||||
<p>Spirit 1.8.0 has been tested to compile and run properly on these compilers:</p>
|
||||
<p>Spirit 1.8 has been tested to compile and run properly on these compilers:</p>
|
||||
<ol>
|
||||
<li>g++ 3.1 and above</li>
|
||||
<li>Comeau 4.24.5 </li>
|
||||
|
||||
@@ -231,9 +231,9 @@
|
||||
NNTP news portal</a> (thanks to <a href=
|
||||
"http://www.gmane.org">www.gmane.org</a>). The news group mirrors the
|
||||
mailing list. Here are two links to the archives: via <a href=
|
||||
"http://news.gmane.org/thread.php?group=gmane.comp.parsers.spirit.general">
|
||||
"http://dir.gmane.org/gmane.comp.parsers.spirit.general">
|
||||
gmane</a>, via <a href=
|
||||
"http://www.geocrawler.com/lists/3/SourceForge/12837/0/">geocrawler</a>.
|
||||
"http://sourceforge.net/mailarchive/forum.php?forum_id=1595gmane.org">geocrawler</a>.
|
||||
</p>
|
||||
<table width="100%" border="0" align="center">
|
||||
<tr>
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
task but through ad hoc hacks using primitive tools such as
|
||||
<tt>scanf</tt>. True, there are tools such as regular-expression
|
||||
libraries (such as <a href=
|
||||
"http://www.boost.org/libs/regex/index.htm">boost regex</a>) or scanners
|
||||
(such as <a href="http://www.boost.org/libs/tokenizer/index.htm">boost
|
||||
"http://www.boost.org/libs/regex/index.html">boost regex</a>) or scanners
|
||||
(such as <a href="http://www.boost.org/libs/tokenizer/index.html">boost
|
||||
tokenizer</a>), but these tools do not scale well when we need to write
|
||||
more elaborate parsers. Attempting to write even a moderately-complex
|
||||
parser using these tools leads to code that is hard to understand and
|
||||
|
||||
@@ -182,7 +182,7 @@ href="http://www.research.att.com/%7Ebs/whitespace98.pdf">Generalizing Overloadi
|
||||
<td width="36" class="table_cells">18.</td>
|
||||
<td width="236" class="table_cells"><a name="regex_boost_doc"></a>Dr. John
|
||||
Maddock</td>
|
||||
<td width="520" class="table_cells"><a href="http://www.boost.org/libs/regex/index.htm">Regex++
|
||||
<td width="520" class="table_cells"><a href="http://www.boost.org/libs/regex/index.html">Regex++
|
||||
Documentation</a><br>
|
||||
http://www.boost.org/libs/regex/index.htm </td>
|
||||
</tr>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<p>The generated parser object acts at the character level, thus an eventually
|
||||
given skip parser is not used during the attempt to match the regular expression
|
||||
(see <a href="faq.html#scanner_business">The Scanner Business</a>).</p>
|
||||
<p>The Regular Expression Parser is implemented by the help of the <a href="http://www.boost.org/libs/regex/index.htm">Boost
|
||||
<p>The Regular Expression Parser is implemented by the help of the <a href="http://www.boost.org/libs/regex/index.html">Boost
|
||||
Regex++ library</a>, so you have to have some limitations in mind. </p>
|
||||
<blockquote>
|
||||
<p><img src="theme/bullet.gif" width="12" height="12"> Boost libraries have
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
</span><span class=identifier>rule_t </span><span class=identifier>two</span><span class=special>;
|
||||
|
||||
</span><span class=identifier>symbols</span><span class=special><</span><span class=identifier>rule_t</span><span class=special>*> </span><span class=identifier>continuations</span><span class=special>;</span></pre>
|
||||
<p>set_rest, the sementic action attached to continuations is:</p>
|
||||
<p>set_rest, the semantic action attached to continuations is:</p>
|
||||
<pre><span class=special> </span><span class=keyword>template </span><span class=special><</span><span class=keyword>typename </span><span class=identifier>Rule</span><span class=special>>
|
||||
</span><span class=keyword>struct </span><span class=identifier>set_rest
|
||||
</span><span class=special>{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
any type, we can store a parser, a rule, or a pointer to a parser or rule, in
|
||||
a closure variable. <em>Yeah, right, so what?...</em> Ok, hold on... What if
|
||||
we can use this closure variable to initiate a parse? Think about it for a second.
|
||||
Suddenly well have some powerful dynamic parsers! Suddenly we'll have a full
|
||||
Suddenly we'll have some powerful dynamic parsers! Suddenly we'll have a full
|
||||
round trip from to <a href="../phoenix/index.html">Phoenix</a> and Spirit and
|
||||
back! <a href="../phoenix/index.html">Phoenix</a> semantic actions choose the
|
||||
right Spirit parser and Spirit parsers choose the right <a href="../phoenix/index.html">Phoenix</a>
|
||||
|
||||
130
example/Jamfile
130
example/Jamfile
@@ -13,236 +13,223 @@
|
||||
# Martin Wille [Jan 15, 2004] : changes for new directory structure
|
||||
# Martin Wille [Jan 20, 2004] : more changes for new directory structure
|
||||
# Joel de Guzman [Jul 29, 2004] : added calc_debug.cpp
|
||||
# Joao Abecasis [Nov 20, 2004] : changes for compiling with miniboost
|
||||
#
|
||||
|
||||
subproject libs/spirit/example ;
|
||||
|
||||
SPIRIT_HEADER_INCLUDE ?= ../../.. ;
|
||||
|
||||
spirit-header-include = <sysinclude>$(SPIRIT_HEADER_INCLUDE) ;
|
||||
|
||||
if $(SPIRIT_BOOST_HEADER_INCLUDE)
|
||||
{
|
||||
spirit-header-include += <sysinclude>$(SPIRIT_BOOST_HEADER_INCLUDE) ;
|
||||
}
|
||||
|
||||
exe ast_calc
|
||||
: fundamental/ast_calc.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe "bind"
|
||||
: fundamental/bind.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe boiler_plate
|
||||
: fundamental/boiler_plate.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe calc_plain
|
||||
: fundamental/calc_plain.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe calc_debug
|
||||
: fundamental/calc_debug.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe comments
|
||||
: fundamental/comments.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe complex_number
|
||||
: fundamental/complex_number.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe error_handling
|
||||
: fundamental/error_handling.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe error_reporting
|
||||
: fundamental/error_reporting.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe file_parser
|
||||
: fundamental/file_parser.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe full_calc
|
||||
: fundamental/full_calc.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe functor_parser
|
||||
: fundamental/functor_parser.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe list_parser
|
||||
: fundamental/list_parser.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe matching_tags
|
||||
: fundamental/matching_tags.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe no_actions
|
||||
: fundamental/no_actions.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe number_list
|
||||
: fundamental/number_list.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe parse_tree_calc1
|
||||
: fundamental/parse_tree_calc1.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe parser_context
|
||||
: fundamental/parser_context.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe phoenix_calc
|
||||
: fundamental/phoenix_calc.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe position_iterator
|
||||
: fundamental/position_iterator/position_iterator.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe refactoring
|
||||
: fundamental/refactoring.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
if $(SPIRIT_HAVE_BOOST_REGEX) != "FALSE"
|
||||
{
|
||||
exe regular_expression
|
||||
: fundamental/regular_expression.cpp
|
||||
: <template>spirit-boost-regex
|
||||
:
|
||||
;
|
||||
}
|
||||
exe regular_expression
|
||||
: fundamental/regular_expression.cpp
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe roman_numerals
|
||||
: fundamental/roman_numerals.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe stuff_vector
|
||||
: fundamental/stuff_vector.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe stuff_vector2
|
||||
: fundamental/stuff_vector2.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe subrule_calc
|
||||
: fundamental/subrule_calc.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe sum
|
||||
: fundamental/sum.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe thousand_separated
|
||||
: fundamental/thousand_separated.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe ast_calc2
|
||||
: fundamental/more_calculators/ast_calc2.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe calc_with_variables
|
||||
: fundamental/more_calculators/calc_with_variables.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe phoenix_subrule_calc
|
||||
: fundamental/more_calculators/phoenix_subrule_calc.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe primitive_calc
|
||||
: fundamental/more_calculators/primitive_calc.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe rpn_calc
|
||||
: fundamental/more_calculators/rpn_calc.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe vmachine_calc
|
||||
: fundamental/more_calculators/vmachine_calc.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe distinct_parser
|
||||
: fundamental/distinct/distinct_parser.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe distinct_parser_dynamic
|
||||
: fundamental/distinct/distinct_parser_dynamic.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
@@ -250,84 +237,81 @@ exe distinct_parser_dynamic
|
||||
|
||||
exe ipv4
|
||||
: intermediate/ipv4.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe ipv4_opt
|
||||
: intermediate/ipv4_opt.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe lazy_parser
|
||||
: intermediate/lazy_parser.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe parameters
|
||||
: intermediate/parameters.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
if $(SPIRIT_HAVE_BOOST_REGEX) != "FALSE"
|
||||
{
|
||||
exe regex_convert
|
||||
: intermediate/regex_convert.cpp
|
||||
: <template>spirit-boost-regex
|
||||
:
|
||||
;
|
||||
}
|
||||
exe regex_convert
|
||||
: intermediate/regex_convert.cpp
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
################################################################################
|
||||
|
||||
exe dynamic_rule
|
||||
: techniques/dynamic_rule.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe epsilon
|
||||
: techniques/epsilon.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe multiple_scanners
|
||||
: techniques/multiple_scanners.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe nabialek
|
||||
: techniques/nabialek.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe no_rule1
|
||||
: techniques/no_rules/no_rule1.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe no_rule2
|
||||
: techniques/no_rules/no_rule2.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe no_rule3
|
||||
: techniques/no_rules/no_rule3.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
exe typeof
|
||||
: techniques/typeof.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
tree_parse_info<> info = ast_parse(str.c_str(), calc);
|
||||
|
||||
@@ -97,7 +97,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
list_parser lp;
|
||||
|
||||
@@ -77,7 +77,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
if (parse(str.c_str(), g, space_p).full)
|
||||
|
||||
@@ -171,7 +171,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
parse_info<> info = parse(str.c_str(), calc, space_p);
|
||||
|
||||
@@ -102,7 +102,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
parse_info<> info = parse(str.c_str(), calc, space_p);
|
||||
|
||||
@@ -77,7 +77,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
complex<double> c;
|
||||
|
||||
@@ -161,7 +161,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
parse_info<> info = parse(str.c_str(), calc, space_p);
|
||||
|
||||
@@ -103,7 +103,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
else if (str[0] == 'a' || str[0] == 'A')
|
||||
|
||||
@@ -88,7 +88,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
parse_info<> info = parse(str.c_str(), p, space_p);
|
||||
|
||||
@@ -137,7 +137,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
const char* str_begin = str.c_str();
|
||||
|
||||
@@ -234,7 +234,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
parse_info<> info = parse(str.c_str(), calc, space_p);
|
||||
|
||||
@@ -109,7 +109,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
double n = 0;
|
||||
|
||||
@@ -68,7 +68,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
double n;
|
||||
|
||||
@@ -130,7 +130,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
double n = 0;
|
||||
|
||||
@@ -257,7 +257,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
code.clear();
|
||||
|
||||
@@ -63,7 +63,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
vector<double> v;
|
||||
|
||||
@@ -170,7 +170,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
const char* first = str.c_str();
|
||||
|
||||
@@ -99,7 +99,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
double n = 0;
|
||||
|
||||
@@ -167,7 +167,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
unsigned n = 0;
|
||||
|
||||
@@ -84,7 +84,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
vector<double> v;
|
||||
|
||||
@@ -95,7 +95,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
vector<std::string> v;
|
||||
|
||||
@@ -113,7 +113,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
parse_info<> info = parse(str.c_str(), calc, space_p);
|
||||
|
||||
@@ -64,7 +64,7 @@ main()
|
||||
string str;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
double n;
|
||||
|
||||
@@ -107,7 +107,7 @@ main()
|
||||
double n;
|
||||
while (getline(cin, str))
|
||||
{
|
||||
if (str[0] == 'q' || str[0] == 'Q')
|
||||
if (str.empty() || str[0] == 'q' || str[0] == 'Q')
|
||||
break;
|
||||
|
||||
if (parse(str.c_str(), ts_real_p[assign_a(n)]).full)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
// shaved off another 20k. Now the code compiles to 16k on MSVC7.1.
|
||||
//
|
||||
// Could we have done better? Yes, but only if only we had typeof! << See
|
||||
// the techniques section of the 1.8.0 User's guide >> ... Someday... :-)
|
||||
// the techniques section of the User's guide >> ... Someday... :-)
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
using namespace std;
|
||||
|
||||
89
example/techniques/right_recursion.cpp
Normal file
89
example/techniques/right_recursion.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005 Joel de Guzman
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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)
|
||||
=============================================================================*/
|
||||
#include <iostream>
|
||||
|
||||
#define BOOST_SPIRIT_DEBUG
|
||||
#include <boost/spirit/core.hpp>
|
||||
|
||||
using namespace boost::spirit;
|
||||
|
||||
struct non_greedy_kleene : public grammar<non_greedy_kleene>
|
||||
{
|
||||
template <typename ScannerT>
|
||||
struct definition
|
||||
{
|
||||
typedef rule<ScannerT> rule_t;
|
||||
rule_t r;
|
||||
|
||||
definition(non_greedy_kleene const& self)
|
||||
{
|
||||
r = (alnum_p >> r) | digit_p;
|
||||
BOOST_SPIRIT_DEBUG_RULE(r);
|
||||
}
|
||||
|
||||
rule_t const&
|
||||
start() const
|
||||
{
|
||||
return r;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct non_greedy_plus : public grammar<non_greedy_plus>
|
||||
{
|
||||
template <typename ScannerT>
|
||||
struct definition
|
||||
{
|
||||
typedef rule<ScannerT> rule_t;
|
||||
rule_t r;
|
||||
|
||||
definition(non_greedy_plus const& self)
|
||||
{
|
||||
r = alnum_p >> (r | digit_p);
|
||||
BOOST_SPIRIT_DEBUG_RULE(r);
|
||||
}
|
||||
|
||||
rule_t const&
|
||||
start() const
|
||||
{
|
||||
return r;
|
||||
}
|
||||
};
|
||||
};
|
||||
int
|
||||
main()
|
||||
{
|
||||
bool success;
|
||||
{
|
||||
non_greedy_kleene k;
|
||||
success = parse("3", k).full;
|
||||
assert(success);
|
||||
success = parse("abcdef3", k).full;
|
||||
assert(success);
|
||||
success = parse("abc2def3", k).full;
|
||||
assert(success);
|
||||
success = parse("abc", k).full;
|
||||
assert(!success);
|
||||
}
|
||||
|
||||
{
|
||||
non_greedy_plus p;
|
||||
success = parse("3", p).full;
|
||||
assert(!success);
|
||||
success = parse("abcdef3", p).full;
|
||||
assert(success);
|
||||
success = parse("abc2def3", p).full;
|
||||
assert(success);
|
||||
success = parse("abc", p).full;
|
||||
assert(!success);
|
||||
}
|
||||
|
||||
std::cout << "SUCCESS!!!\n";
|
||||
return 0;
|
||||
}
|
||||
@@ -34,6 +34,9 @@ Iterators:
|
||||
|
||||
single_view_iterator
|
||||
A single element iterator. See single_view below.
|
||||
|
||||
cons_iterator
|
||||
An iterator into a cons list. See cons below.
|
||||
|
||||
transform_view_iterator
|
||||
Given a transform-function, transforms the elements being
|
||||
@@ -63,6 +66,9 @@ Sequences and Views:
|
||||
|
||||
joint_view
|
||||
A two-sequence view (concatenates two sequences)
|
||||
|
||||
cons
|
||||
A cons-cell that can be used to build a singly-linked list.
|
||||
|
||||
range
|
||||
Holds an iterator pair that represents a begin/end range.
|
||||
@@ -80,7 +86,7 @@ Basic functions and meta_functions on sequences:
|
||||
operator : tuple operators ==, !=, <, >, <=, >=
|
||||
begin : start of sequence
|
||||
end : end of sequence
|
||||
make-tuple : make a tuple
|
||||
make_tuple : make a tuple
|
||||
tie : make a tuple of references
|
||||
generate : given a fusion sequence, generate a tuple
|
||||
get<N> : get the nth element of a tuple
|
||||
@@ -116,6 +122,7 @@ Algorithms:
|
||||
remove_if
|
||||
replace
|
||||
transform
|
||||
any
|
||||
|
||||
TODO:
|
||||
iteration is limited to input_iterator
|
||||
|
||||
@@ -8,198 +8,201 @@
|
||||
|
||||
subproject libs/spirit/fusion/test ;
|
||||
|
||||
SPIRIT_HEADER_INCLUDE ?= ../../../.. ;
|
||||
|
||||
spirit-header-include = <sysinclude>$(SPIRIT_HEADER_INCLUDE) ;
|
||||
|
||||
if $(SPIRIT_BOOST_HEADER_INCLUDE)
|
||||
{
|
||||
spirit-header-include += <sysinclude>$(SPIRIT_BOOST_HEADER_INCLUDE) ;
|
||||
}
|
||||
|
||||
unit-test fixed_tuple_tests
|
||||
: fixed_tuple_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test tuple_construction_tests
|
||||
: tuple_construction_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test tuple_element_access_tests
|
||||
: tuple_element_access_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test tuple_copy_tests
|
||||
: tuple_copy_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test tuple_comparison_tests
|
||||
: tuple_comparison_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test vc6_bug_001
|
||||
: vc6_bug_001.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test tuple_mutate_tests
|
||||
: tuple_mutate_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test misc_tuple_tests
|
||||
: misc_tuple_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test make_tuple_tests
|
||||
: make_tuple_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test tie_tests
|
||||
: tie_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test tuple_iterator_tests
|
||||
: tuple_iterator_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test io_tests
|
||||
: io_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test single_view_tests
|
||||
: single_view_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test type_sequence_tests
|
||||
: type_sequence_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test joint_view_tests
|
||||
: joint_view_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test push_back_tests
|
||||
: push_back_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test push_front_tests
|
||||
: push_front_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test find_tests
|
||||
: find_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test find_if_tests
|
||||
: find_if_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test filter_view_tests
|
||||
: filter_view_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test filter_tests
|
||||
: filter_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test range_tests
|
||||
: range_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test erase_tests
|
||||
: erase_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test for_each_tests
|
||||
: for_each_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test fold_tests
|
||||
: fold_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test insert_tests
|
||||
: insert_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test remove_tests
|
||||
: remove_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test remove_if_tests
|
||||
: remove_if_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test replace_tests
|
||||
: replace_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test transform_view_tests
|
||||
: transform_view_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test transform_tests
|
||||
: transform_tests.cpp
|
||||
: $(spirit-header-include)
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test cons_tests
|
||||
: cons_tests.cpp
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
unit-test any_tests
|
||||
: any_tests.cpp
|
||||
: <sysinclude>$(BOOST_ROOT)
|
||||
:
|
||||
;
|
||||
|
||||
|
||||
32
fusion/test/any_tests.cpp
Executable file
32
fusion/test/any_tests.cpp
Executable file
@@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/spirit/fusion/sequence/tuple.hpp>
|
||||
#include <boost/spirit/fusion/algorithm/any.hpp>
|
||||
#include <boost/spirit/fusion/algorithm/for_each.hpp>
|
||||
#include <boost/lambda/lambda.hpp>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
/// Testing any
|
||||
|
||||
{
|
||||
boost::fusion::tuple<int,short,double> t(1, 2, 3.3);
|
||||
BOOST_TEST((boost::fusion::any(t, boost::lambda::_1 == 2)));
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::tuple<int,short,double> t(1, 2, 3.3);
|
||||
BOOST_TEST((!boost::fusion::any(t, boost::lambda::_1 == 3)));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
63
fusion/test/cons_tests.cpp
Executable file
63
fusion/test/cons_tests.cpp
Executable file
@@ -0,0 +1,63 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <string>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/spirit/fusion/sequence/cons.hpp>
|
||||
#include <boost/lambda/lambda.hpp>
|
||||
#include <boost/spirit/fusion/algorithm/for_each.hpp>
|
||||
#include <boost/spirit/fusion/algorithm/filter.hpp>
|
||||
#include <boost/spirit/fusion/sequence/io.hpp>
|
||||
#include <boost/spirit/fusion/sequence/tuple.hpp>
|
||||
#include <boost/spirit/fusion/sequence/equal_to.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
std::cout << boost::fusion::tuple_open('[');
|
||||
std::cout << boost::fusion::tuple_close(']');
|
||||
std::cout << boost::fusion::tuple_delimiter(", ");
|
||||
|
||||
/// Testing cons
|
||||
|
||||
{
|
||||
std::string hello("hello");
|
||||
boost::fusion::cons<int,boost::fusion::cons<std::string> > ns =
|
||||
boost::fusion::make_cons(1, boost::fusion::make_cons(hello));
|
||||
|
||||
BOOST_TEST((*boost::fusion::begin(ns) == 1));
|
||||
BOOST_TEST((*boost::fusion::next(boost::fusion::begin(ns)) == hello));
|
||||
|
||||
*boost::fusion::begin(ns) += 1;
|
||||
*boost::fusion::next(boost::fusion::begin(ns)) += ' ';
|
||||
|
||||
BOOST_TEST((*boost::fusion::begin(ns) == 2));
|
||||
BOOST_TEST((*boost::fusion::next(boost::fusion::begin(ns)) == hello + ' '));
|
||||
|
||||
boost::fusion::for_each(ns, boost::lambda::_1 += ' ');
|
||||
|
||||
BOOST_TEST((*boost::fusion::begin(ns) == 2 + ' '));
|
||||
BOOST_TEST((*boost::fusion::next(boost::fusion::begin(ns)) == hello + ' ' + ' '));
|
||||
}
|
||||
|
||||
{
|
||||
boost::fusion::tuple<int, float> t(1, 1.1f);
|
||||
boost::fusion::cons<int, boost::fusion::cons<float> > nf =
|
||||
boost::fusion::make_cons(1, boost::fusion::make_cons(1.1f));
|
||||
|
||||
BOOST_TEST((t == nf));
|
||||
BOOST_TEST((boost::fusion::tuple<int>(1) == boost::fusion::filter(nf, boost::is_same<boost::mpl::_,int>())));
|
||||
|
||||
std::cout << nf << std::endl;
|
||||
std::cout << boost::fusion::filter(nf, boost::is_same<boost::mpl::_,int>()) << std::endl;
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
49
fusion/test/insert_tests_mpl.cpp
Normal file
49
fusion/test/insert_tests_mpl.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/spirit/fusion/sequence/tuple.hpp>
|
||||
#include <boost/spirit/fusion/sequence/io.hpp>
|
||||
#include <boost/spirit/fusion/sequence/equal_to.hpp>
|
||||
#include <boost/spirit/fusion/sequence/make_tuple.hpp>
|
||||
#include <boost/spirit/fusion/algorithm/insert.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
#include <boost/mpl/begin_end.hpp>
|
||||
#include <boost/mpl/advance.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <string>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
/* using boost::mpl::vector_c;
|
||||
using boost::mpl::advance;
|
||||
using boost::mpl::int_;*/
|
||||
namespace fusion = boost::fusion;
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
/// Testing insert
|
||||
|
||||
//Needed to split insert_tests.cpp because of compiler limit in MSVC 6.5
|
||||
|
||||
{
|
||||
typedef mpl::vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
|
||||
typedef mpl::begin<mpl_vec>::type mpl_vec_begin;
|
||||
typedef mpl::advance<mpl_vec_begin, mpl::int_<3> >::type mpl_vec_at3;
|
||||
|
||||
std::cout << fusion::insert(mpl_vec(), mpl_vec_at3(), mpl::int_<66>()) << std::endl;
|
||||
BOOST_TEST((fusion::insert(mpl_vec(), mpl_vec_at3(), mpl::int_<66>())
|
||||
== make_tuple(1, 2, 3, 66, 4, 5)));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
107
fusion/test/joint_view_tests_2.cpp
Normal file
107
fusion/test/joint_view_tests_2.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/spirit/fusion/sequence/tuple.hpp>
|
||||
#include <boost/spirit/fusion/sequence/io.hpp>
|
||||
#include <boost/spirit/fusion/sequence/generate.hpp>
|
||||
#include <boost/spirit/fusion/sequence/equal_to.hpp>
|
||||
#include <boost/spirit/fusion/sequence/make_tuple.hpp>
|
||||
#include <boost/spirit/fusion/sequence/joint_view.hpp>
|
||||
#include <boost/spirit/fusion/sequence/get.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
|
||||
struct X
|
||||
{
|
||||
operator char const*() const
|
||||
{
|
||||
return "<X-object>";
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
/// Testing joint_view
|
||||
{
|
||||
typedef tuple<int> t1_type;
|
||||
t1_type t1(777);
|
||||
typedef tuple<int, char, double> t2_type;
|
||||
t2_type t2(1, 'x', 3.3);
|
||||
|
||||
{
|
||||
typedef joint_view<t1_type, t2_type> view_type;
|
||||
view_type view(t1, t2);
|
||||
std::cout << view << std::endl;
|
||||
BOOST_TEST((view == make_tuple(777, 1, 'x', 3.3)));
|
||||
}
|
||||
|
||||
{
|
||||
typedef joint_view<t2_type, t1_type> view_type;
|
||||
view_type view(t2, t1);
|
||||
std::cout << view << std::endl;
|
||||
BOOST_TEST((view == make_tuple(1, 'x', 3.3, 777)));
|
||||
}
|
||||
|
||||
{
|
||||
typedef joint_view<t2_type, t1_type> jv_type;
|
||||
typedef joint_view<jv_type, jv_type> jv2_type;
|
||||
|
||||
jv_type jv(t2, t1);
|
||||
jv2_type jv2(jv, jv);
|
||||
|
||||
std::cout << jv << std::endl;
|
||||
std::cout << jv2 << std::endl;
|
||||
|
||||
BOOST_TEST(jv2
|
||||
== make_tuple(1, 'x', 3.3, 777, 1, 'x', 3.3, 777));
|
||||
}
|
||||
|
||||
{
|
||||
typedef joint_view<t2_type, t1_type> jt_type;
|
||||
typedef joint_view<t1_type, t2_type> jv2_type;
|
||||
typedef joint_view<jt_type, jv2_type> jv3_type;
|
||||
|
||||
jt_type jt(t2, t1);
|
||||
jv2_type jv2(t1, t2);
|
||||
jv3_type jv3(jt, jv2);
|
||||
|
||||
std::cout << jt << std::endl;
|
||||
std::cout << jv2 << std::endl;
|
||||
std::cout << jv3 << std::endl;
|
||||
|
||||
BOOST_TEST(jv3
|
||||
== make_tuple(1, 'x', 3.3, 777, 777, 1, 'x', 3.3));
|
||||
}
|
||||
|
||||
{
|
||||
typedef joint_view<tuple<>, t1_type> jt_type;
|
||||
tuple<> empty;
|
||||
jt_type jt(empty, t1);
|
||||
std::cout << generate(jt) << std::endl;
|
||||
BOOST_TEST(generate(jt) == make_tuple(777));
|
||||
}
|
||||
|
||||
{
|
||||
typedef joint_view<t1_type, tuple<> > jt_type;
|
||||
tuple<> empty;
|
||||
jt_type jt(t1, empty);
|
||||
std::cout << generate(jt) << std::endl;
|
||||
BOOST_TEST(generate(jt) == make_tuple(777));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
38
fusion/test/push_back_tests_mpl.cpp
Normal file
38
fusion/test/push_back_tests_mpl.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/spirit/fusion/sequence/tuple.hpp>
|
||||
#include <boost/spirit/fusion/sequence/io.hpp>
|
||||
#include <boost/spirit/fusion/sequence/equal_to.hpp>
|
||||
#include <boost/spirit/fusion/sequence/make_tuple.hpp>
|
||||
#include <boost/spirit/fusion/algorithm/push_back.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
#include <string>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
/// Testing push_back
|
||||
|
||||
|
||||
{
|
||||
typedef boost::mpl::vector_c<int, 1, 2, 3, 4, 5> mpl_vec;
|
||||
std::cout << boost::fusion::push_back(mpl_vec(), boost::mpl::int_<6>()) << std::endl;
|
||||
BOOST_TEST((boost::fusion::push_back(mpl_vec(), boost::mpl::int_<6>())
|
||||
== make_tuple(1, 2, 3, 4, 5, 6)));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
59
fusion/test/remove_tests_mpl.cpp
Normal file
59
fusion/test/remove_tests_mpl.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/spirit/fusion/sequence/tuple.hpp>
|
||||
#include <boost/spirit/fusion/sequence/io.hpp>
|
||||
#include <boost/spirit/fusion/sequence/make_tuple.hpp>
|
||||
#include <boost/spirit/fusion/sequence/equal_to.hpp>
|
||||
#include <boost/spirit/fusion/algorithm/remove.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
struct X
|
||||
{
|
||||
operator char const*() const
|
||||
{
|
||||
return "<X-object>";
|
||||
}
|
||||
};
|
||||
|
||||
struct Y
|
||||
{
|
||||
operator char const*() const
|
||||
{
|
||||
return "<Y-object>";
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using boost::mpl::identity;
|
||||
using boost::mpl::vector;
|
||||
namespace fusion = boost::fusion;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
std::cout << tuple_delimiter(", ");
|
||||
|
||||
/// Testing remove
|
||||
|
||||
{
|
||||
typedef vector<Y, char, long, X, bool, double> mpl_vec;
|
||||
BOOST_TEST((fusion::remove(mpl_vec(), identity<X>())
|
||||
== tuple<Y, char, long, bool, double>()));
|
||||
BOOST_TEST((fusion::remove(mpl_vec(), identity<Y>())
|
||||
== tuple<char, long, X, bool, double>()));
|
||||
BOOST_TEST((fusion::remove(mpl_vec(), identity<long>())
|
||||
== tuple<Y, char, X, bool, double>()));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// If SPIRIT_DEBUG is defined, the following header includes the
|
||||
// If BOOST_SPIRIT_DEBUG is defined, the following header includes the
|
||||
// Spirit.Debug layer, otherwise the non-debug Spirit.Core is included.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
#if defined(NDEBUG)
|
||||
#define BOOST_SPIRIT_ASSERT(x)
|
||||
#elif defined (BOOST_SPIRIT_ASSERT_EXCEPTION)
|
||||
#define BOOST_SPIRIT_ASSERT_AUX(f, l, x) \
|
||||
#define BOOST_SPIRIT_ASSERT_AUX(f, l, x) BOOST_SPIRIT_ASSERT_AUX2(f, l, x)
|
||||
#define BOOST_SPIRIT_ASSERT_AUX2(f, l, x) \
|
||||
do{ if (!(x)) boost::throw_exception( \
|
||||
BOOST_SPIRIT_ASSERT_EXCEPTION(f "(" #l "): " #x)); } while(0)
|
||||
#define BOOST_SPIRIT_ASSERT(x) BOOST_SPIRIT_ASSERT_AUX(__FILE__, __LINE__, x)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace boost { namespace spirit {
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse(ScannerT const& scan) const
|
||||
{
|
||||
if (positive_ == cond())
|
||||
if (positive_ == bool(cond())) // allow cond to return int
|
||||
return scan.empty_match();
|
||||
else
|
||||
return scan.no_match();
|
||||
@@ -59,7 +59,9 @@ namespace boost { namespace spirit {
|
||||
CondT cond;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) // VC 7.1
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || \
|
||||
BOOST_WORKAROUND(BOOST_MSVC, == 1400)
|
||||
// VC 7.1 and VC8
|
||||
template <typename CondT>
|
||||
inline condition_parser<CondT, false>
|
||||
operator~(condition_parser<CondT, true> const& p)
|
||||
@@ -69,12 +71,12 @@ namespace boost { namespace spirit {
|
||||
inline condition_parser<CondT, true>
|
||||
operator~(condition_parser<CondT, false> const& p)
|
||||
{ return p.negate(); }
|
||||
#else // BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
#else // BOOST_WORKAROUND(BOOST_MSVC, == 1310) || == 1400
|
||||
template <typename CondT, bool positive>
|
||||
inline condition_parser<CondT, !positive>
|
||||
operator~(condition_parser<CondT, positive> const& p)
|
||||
{ return p.negate(); }
|
||||
#endif // BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
#endif // BOOST_WORKAROUND(BOOST_MSVC, == 1310) || == 1400
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace boost { namespace spirit {
|
||||
iterator_t save = scan.first;
|
||||
if (result_t hl = this->left().parse(scan))
|
||||
{
|
||||
ScannerT bscan(scan.first, scan.first);
|
||||
ScannerT bscan(scan.first, scan.first, scan);
|
||||
scan.first = save;
|
||||
result_t hr = this->right().parse(bscan);
|
||||
if (hl.length() == hr.length())
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace impl
|
||||
{
|
||||
@@ -22,14 +25,33 @@ namespace boost { namespace spirit { namespace impl
|
||||
const_reference;
|
||||
|
||||
// case where src *IS* convertible to T (dest)
|
||||
template <typename T2>
|
||||
static void
|
||||
convert(boost::optional<T>& dest, const_reference src)
|
||||
{ dest.reset(src); }
|
||||
convert(boost::optional<T>& dest, T2 const& src, mpl::true_)
|
||||
{
|
||||
dest.reset(src);
|
||||
}
|
||||
|
||||
// case where src *IS NOT* convertible to T (dest)
|
||||
template <typename T2>
|
||||
static void
|
||||
convert(boost::optional<T>& dest, .../*src*/)
|
||||
{ dest.reset(); }
|
||||
convert(boost::optional<T>& dest, T2 const& /*src*/, mpl::false_)
|
||||
{
|
||||
dest.reset();
|
||||
}
|
||||
|
||||
static void
|
||||
convert(boost::optional<T>& dest, nil_t/*src*/)
|
||||
{
|
||||
dest.reset();
|
||||
}
|
||||
|
||||
template <typename T2>
|
||||
static void
|
||||
convert(boost::optional<T>& dest, T2 const& src)
|
||||
{
|
||||
convert(dest, src, is_convertible<T2, T>());
|
||||
}
|
||||
|
||||
template <typename OtherMatchT>
|
||||
static void
|
||||
|
||||
@@ -325,7 +325,7 @@ struct grammar_definition
|
||||
|
||||
public:
|
||||
typedef entry_grammar<DerivedT, N, ContextT> self_t;
|
||||
typedef DerivedT const& embed_t;
|
||||
typedef self_t embed_t;
|
||||
typedef typename ContextT::context_linker_t context_t;
|
||||
typedef typename context_t::attr_t attr_t;
|
||||
|
||||
@@ -348,8 +348,8 @@ struct grammar_definition
|
||||
{
|
||||
typedef typename parser_result<self_t, ScannerT>::type result_t;
|
||||
typedef parser_scanner_linker<ScannerT> scanner_t;
|
||||
BOOST_SPIRIT_CONTEXT_PARSE(scan, *this, scanner_t, context_t,
|
||||
result_t)
|
||||
BOOST_SPIRIT_CONTEXT_PARSE(scan, target_grammar, scanner_t,
|
||||
context_t, result_t)
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#ifdef BOOST_SPIRIT_THREADSAFE
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/once.hpp>
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -54,6 +55,10 @@ namespace boost { namespace spirit {
|
||||
void release_object_id(object_id);
|
||||
|
||||
private:
|
||||
#ifdef BOOST_SPIRIT_THREADSAFE
|
||||
static boost::mutex &mutex_instance();
|
||||
static void mutex_init();
|
||||
#endif
|
||||
|
||||
boost::shared_ptr<object_with_id_base_supply<IdT> > id_supply;
|
||||
};
|
||||
@@ -127,7 +132,9 @@ namespace boost { namespace spirit {
|
||||
{
|
||||
{
|
||||
#ifdef BOOST_SPIRIT_THREADSAFE
|
||||
static boost::mutex mutex;
|
||||
static boost::once_flag been_here = BOOST_ONCE_INIT;
|
||||
boost::call_once(mutex_init, been_here);
|
||||
boost::mutex &mutex = mutex_instance();
|
||||
boost::mutex::scoped_lock lock(mutex);
|
||||
#endif
|
||||
static boost::shared_ptr<object_with_id_base_supply<IdT> >
|
||||
@@ -149,6 +156,27 @@ namespace boost { namespace spirit {
|
||||
id_supply->release(id);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
#ifdef BOOST_SPIRIT_THREADSAFE
|
||||
template <typename TagT, typename IdT>
|
||||
inline boost::mutex &
|
||||
object_with_id_base<TagT, IdT>::mutex_instance()
|
||||
{
|
||||
static boost::mutex mutex;
|
||||
return mutex;
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////
|
||||
#ifdef BOOST_SPIRIT_THREADSAFE
|
||||
template <typename TagT, typename IdT>
|
||||
inline void
|
||||
object_with_id_base<TagT, IdT>::mutex_init()
|
||||
{
|
||||
mutex_instance();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace impl
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#if !defined(BOOST_SPIRIT_PARSER_ID_HPP)
|
||||
#define BOOST_SPIRIT_PARSER_ID_HPP
|
||||
|
||||
#if defined(BOOST_SPIRIT_DEBUG)
|
||||
# include <ostream>
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
|
||||
@@ -178,76 +178,77 @@ namespace boost { namespace spirit {
|
||||
isalnum_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return isalnum(to_int_type(c));
|
||||
return isalnum(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isalpha_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return isalpha(to_int_type(c));
|
||||
return isalpha(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
iscntrl_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return iscntrl(to_int_type(c));
|
||||
return iscntrl(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isdigit_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return isdigit(to_int_type(c));
|
||||
return isdigit(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isgraph_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return isgraph(to_int_type(c));
|
||||
return isgraph(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
islower_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return islower(to_int_type(c));
|
||||
return islower(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isprint_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return isprint(to_int_type(c));
|
||||
return isprint(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
ispunct_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return ispunct(to_int_type(c));
|
||||
return ispunct(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isspace_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return isspace(to_int_type(c));
|
||||
return isspace(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isupper_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return isupper(to_int_type(c)); }
|
||||
return isupper(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isxdigit_(char c)
|
||||
{
|
||||
using namespace std;
|
||||
return isxdigit(to_int_type(c));
|
||||
return isxdigit(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
@@ -276,77 +277,77 @@ namespace boost { namespace spirit {
|
||||
isalnum_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswalnum(to_int_type(c));
|
||||
return iswalnum(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isalpha_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswalpha(to_int_type(c));
|
||||
return iswalpha(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
iscntrl_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswcntrl(to_int_type(c));
|
||||
return iswcntrl(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isdigit_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswdigit(to_int_type(c));
|
||||
return iswdigit(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isgraph_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswgraph(to_int_type(c));
|
||||
return iswgraph(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
islower_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswlower(to_int_type(c));
|
||||
return iswlower(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isprint_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswprint(to_int_type(c));
|
||||
return iswprint(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
ispunct_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswpunct(to_int_type(c));
|
||||
return iswpunct(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isspace_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswspace(to_int_type(c));
|
||||
return iswspace(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isupper_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswupper(to_int_type(c));
|
||||
return iswupper(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
isxdigit_(wchar_t c)
|
||||
{
|
||||
using namespace std;
|
||||
return iswxdigit(to_int_type(c));
|
||||
return iswxdigit(to_int_type(c)) ? true : false;
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
||||
@@ -254,6 +254,13 @@ namespace boost { namespace spirit {
|
||||
return strlit<CharT const*>(str);
|
||||
}
|
||||
|
||||
template <typename CharT>
|
||||
inline strlit<CharT *>
|
||||
str_p(CharT * str)
|
||||
{
|
||||
return strlit<CharT *>(str);
|
||||
}
|
||||
|
||||
template <typename IteratorT>
|
||||
inline strlit<IteratorT>
|
||||
str_p(IteratorT first, IteratorT last)
|
||||
@@ -580,7 +587,8 @@ namespace boost { namespace spirit {
|
||||
++len;
|
||||
}
|
||||
|
||||
if (!scan.at_end() && *scan == '\n') // LF
|
||||
// Don't call skipper here
|
||||
if (scan.first != scan.last && *scan == '\n') // LF
|
||||
{
|
||||
++scan.first;
|
||||
++len;
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
// BOOST_SPIRIT_SELECT_LIMIT > 0
|
||||
// BOOST_SPIRIT_SELECT_LIMIT <= 15
|
||||
//
|
||||
// [Pushed this down a little to make CW happy with BOOST_STATIC_ASSERT]
|
||||
// [Otherwise, it complains: 'boost_static_assert_test_42' redefined]
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_STATIC_ASSERT(BOOST_SPIRIT_SELECT_LIMIT <= PHOENIX_LIMIT);
|
||||
BOOST_STATIC_ASSERT(BOOST_SPIRIT_SELECT_LIMIT > 0);
|
||||
|
||||
@@ -114,7 +114,7 @@ struct switch_parser
|
||||
impl::make_cond_functor<CondT>::do_(cond));
|
||||
}
|
||||
|
||||
CondT const &cond;
|
||||
CondT cond;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
71
include/boost/spirit/fusion/algorithm/any.hpp
Executable file
71
include/boost/spirit/fusion/algorithm/any.hpp
Executable file
@@ -0,0 +1,71 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ALGORITHM_ANY_HPP)
|
||||
#define FUSION_ALGORITHM_ANY_HPP
|
||||
|
||||
#include <boost/spirit/fusion/sequence/begin.hpp>
|
||||
#include <boost/spirit/fusion/sequence/end.hpp>
|
||||
#include <boost/spirit/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/spirit/fusion/algorithm/detail/any.ipp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace meta
|
||||
{
|
||||
template <typename Sequence, typename F>
|
||||
struct any
|
||||
{
|
||||
typedef bool type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace function
|
||||
{
|
||||
struct any
|
||||
{
|
||||
template <typename Sequence, typename F>
|
||||
struct apply
|
||||
{
|
||||
typedef bool type;
|
||||
};
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline bool
|
||||
operator()(Sequence const& seq, F const& f) const
|
||||
{
|
||||
return detail::any(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, meta::equal_to<
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
inline bool
|
||||
operator()(Sequence& seq, F const& f) const
|
||||
{
|
||||
return detail::any(
|
||||
fusion::begin(seq)
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, meta::equal_to<
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function::any const any = function::any();
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
39
include/boost/spirit/fusion/algorithm/detail/any.ipp
Executable file
39
include/boost/spirit/fusion/algorithm/detail/any.ipp
Executable file
@@ -0,0 +1,39 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ALGORITHM_DETAIL_ANY_IPP)
|
||||
#define FUSION_ALGORITHM_DETAIL_ANY_IPP
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/spirit/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/spirit/fusion/iterator/next.hpp>
|
||||
#include <boost/spirit/fusion/iterator/deref.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
any(First const&, Last const&, F const&, mpl::true_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename F>
|
||||
inline bool
|
||||
any(First const& first, Last const& last, F const& f, mpl::false_)
|
||||
{
|
||||
if(f(*first))
|
||||
return true;
|
||||
return detail::any(fusion::next(first), last, f
|
||||
, meta::equal_to<BOOST_DEDUCED_TYPENAME meta::next<First>::type, Last>());
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -9,6 +10,7 @@
|
||||
#define FUSION_ALGORITHM_DETAIL_FIND_IF_HPP
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
#include <boost/spirit/fusion/iterator/value_of.hpp>
|
||||
@@ -58,6 +60,15 @@ namespace boost { namespace fusion { namespace detail
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename First, typename Last, typename Pred>
|
||||
struct static_find_if;
|
||||
|
||||
namespace static_find_if_detail {
|
||||
template <typename First,typename Last,typename Pred,typename Iterator>
|
||||
typename main_find_if<First,Last,typename mpl::lambda<Pred>::type>::type
|
||||
call(static_find_if<First,Last,Pred> const& obj,Iterator const& iter);
|
||||
}
|
||||
|
||||
template <typename First, typename Last, typename Pred>
|
||||
struct static_find_if
|
||||
{
|
||||
@@ -69,28 +80,38 @@ namespace boost { namespace fusion { namespace detail
|
||||
>::type
|
||||
type;
|
||||
|
||||
template <typename Iterator>
|
||||
//Workaround to please MSVC
|
||||
template<typename Iterator>
|
||||
static type
|
||||
call(Iterator const& iter, mpl::true_)
|
||||
call(Iterator const& iter)
|
||||
{
|
||||
return static_find_if_detail::call(static_find_if<First,Last,Pred>(),iter);
|
||||
}
|
||||
};
|
||||
|
||||
namespace static_find_if_detail {
|
||||
template <typename First,typename Last,typename Pred,typename Iterator>
|
||||
typename static_find_if<First,Last,Pred>::type
|
||||
call(static_find_if<First,Last,Pred> const&, Iterator const& iter, mpl::true_)
|
||||
{
|
||||
return iter;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
static type
|
||||
call(Iterator const& iter, mpl::false_)
|
||||
template <typename First,typename Last,typename Pred,typename Iterator>
|
||||
typename static_find_if<First,Last,Pred>::type
|
||||
call(static_find_if<First,Last,Pred> const& obj,Iterator const& iter, mpl::false_)
|
||||
{
|
||||
return call(fusion::next(iter));
|
||||
return call(obj,fusion::next(iter));
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
static type
|
||||
call(Iterator const& iter)
|
||||
template <typename First,typename Last,typename Pred,typename Iterator>
|
||||
typename main_find_if<First,Last,typename mpl::lambda<Pred>::type>::type
|
||||
call(static_find_if<First,Last,Pred> const& obj,Iterator const& iter)
|
||||
{
|
||||
typedef meta::equal_to<Iterator, type> found;
|
||||
return call(iter, found());
|
||||
};
|
||||
};
|
||||
typedef meta::equal_to<Iterator, BOOST_DEDUCED_TYPENAME static_find_if<First,Last,Pred>::type> found;
|
||||
return call(obj,iter, found());
|
||||
};
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -20,7 +21,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
template <typename Iterator, typename State, typename F>
|
||||
struct fold_apply
|
||||
{
|
||||
typedef typename F::template apply<
|
||||
typedef typename fusion_apply2<F,
|
||||
typename meta::value_of<Iterator>::type, State
|
||||
>::type type;
|
||||
};
|
||||
@@ -78,7 +79,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
, last
|
||||
, f(*first, state)
|
||||
, f
|
||||
, is_same<typename meta::next<First>::type, Last>()
|
||||
, is_same<BOOST_DEDUCED_TYPENAME meta::next<First>::type, Last>()
|
||||
);
|
||||
}
|
||||
}}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -27,7 +28,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
f(*first);
|
||||
detail::for_each(fusion::next(first), last, f
|
||||
, meta::equal_to<typename meta::next<First>::type, Last>());
|
||||
, meta::equal_to<BOOST_DEDUCED_TYPENAME meta::next<First>::type, Last>());
|
||||
}
|
||||
}}}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -25,7 +26,9 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef typename meta::begin<Sequence>::type first_type;
|
||||
typedef typename meta::end<Sequence>::type last_type;
|
||||
#if! BOOST_WORKAROUND(BOOST_MSVC,<=1300)
|
||||
BOOST_STATIC_ASSERT((!meta::equal_to<Position, last_type>::value));
|
||||
#endif
|
||||
|
||||
typedef typename meta::next<Position>::type next_type;
|
||||
typedef range<first_type, Position> left_type;
|
||||
@@ -45,10 +48,10 @@ namespace boost { namespace fusion
|
||||
typename apply<Sequence const, Position>::type
|
||||
operator()(Sequence const& seq, Position const& pos) const
|
||||
{
|
||||
typedef apply<Sequence const, Position> meta;
|
||||
typedef typename meta::left_type left_type;
|
||||
typedef typename meta::right_type right_type;
|
||||
typedef typename meta::type result_type;
|
||||
typedef apply<Sequence const, Position> meta_type;
|
||||
typedef typename meta_type::left_type left_type;
|
||||
typedef typename meta_type::right_type right_type;
|
||||
typedef typename meta_type::type result_type;
|
||||
|
||||
left_type left(fusion::begin(seq), pos);
|
||||
right_type right(fusion::next(pos), fusion::end(seq));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -43,9 +44,9 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef
|
||||
detail::static_find_if<
|
||||
typename meta::begin<Sequence const>::type
|
||||
, typename meta::end<Sequence const>::type
|
||||
, is_same<mpl::_, typename T::type>
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence const>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence const>::type
|
||||
, is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type>
|
||||
>
|
||||
filter;
|
||||
|
||||
@@ -58,9 +59,9 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef
|
||||
detail::static_find_if<
|
||||
typename meta::begin<Sequence>::type
|
||||
, typename meta::end<Sequence>::type
|
||||
, is_same<mpl::_, typename T::type>
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type
|
||||
, is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type>
|
||||
>
|
||||
filter;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -42,8 +43,8 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef
|
||||
detail::static_find_if<
|
||||
typename meta::begin<Sequence const>::type
|
||||
, typename meta::end<Sequence const>::type
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence const>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence const>::type
|
||||
, Pred
|
||||
>
|
||||
filter;
|
||||
@@ -57,8 +58,8 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef
|
||||
detail::static_find_if<
|
||||
typename meta::begin<Sequence>::type
|
||||
, typename meta::end<Sequence>::type
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type
|
||||
, Pred
|
||||
>
|
||||
filter;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -45,8 +46,8 @@ namespace boost { namespace fusion
|
||||
, state
|
||||
, f
|
||||
, is_same<
|
||||
typename meta::begin<Sequence const>::type
|
||||
, typename meta::end<Sequence const>::type>()
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence const>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence const>::type>()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,8 +61,8 @@ namespace boost { namespace fusion
|
||||
, state
|
||||
, f
|
||||
, is_same<
|
||||
typename meta::begin<Sequence>::type
|
||||
, typename meta::end<Sequence>::type>()
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -43,8 +44,8 @@ namespace boost { namespace fusion
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, meta::equal_to<
|
||||
typename meta::begin<Sequence>::type
|
||||
, typename meta::end<Sequence>::type>());
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
|
||||
}
|
||||
|
||||
template <typename Sequence, typename F>
|
||||
@@ -56,8 +57,8 @@ namespace boost { namespace fusion
|
||||
, fusion::end(seq)
|
||||
, f
|
||||
, meta::equal_to<
|
||||
typename meta::begin<Sequence>::type
|
||||
, typename meta::end<Sequence>::type>());
|
||||
BOOST_DEDUCED_TYPENAME meta::begin<Sequence>::type
|
||||
, BOOST_DEDUCED_TYPENAME meta::end<Sequence>::type>());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -61,12 +62,12 @@ namespace boost { namespace fusion
|
||||
inline typename apply<Sequence, Position, T>::type
|
||||
operator()(Sequence& seq, Position const& pos, T const& x) const
|
||||
{
|
||||
typedef apply<Sequence, Position, T> meta;
|
||||
typedef typename meta::left_type left_type;
|
||||
typedef typename meta::right_type right_type;
|
||||
typedef typename meta::left_insert_type left_insert_type;
|
||||
typedef typename meta::insert_type insert_type;
|
||||
typedef typename meta::type result;
|
||||
typedef apply<Sequence, Position, T> meta_type;
|
||||
typedef typename meta_type::left_type left_type;
|
||||
typedef typename meta_type::right_type right_type;
|
||||
typedef typename meta_type::left_insert_type left_insert_type;
|
||||
typedef typename meta_type::insert_type insert_type;
|
||||
typedef typename meta_type::type result;
|
||||
|
||||
left_type left(fusion::begin(seq), pos);
|
||||
right_type right(pos, fusion::end(seq));
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define FUSION_ALGORITHM_PUSH_BACK_HPP
|
||||
|
||||
#include <boost/spirit/fusion/sequence/single_view.hpp>
|
||||
#include <boost/spirit/fusion/sequence/joint_view.hpp>
|
||||
#include <boost/spirit/fusion/sequence/append_view.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@@ -18,7 +18,7 @@ namespace boost { namespace fusion
|
||||
template <typename Sequence, typename T>
|
||||
struct push_back
|
||||
{
|
||||
typedef joint_view<Sequence, single_view<T> > type;
|
||||
typedef append_view<Sequence, T> type;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,18 +33,16 @@ namespace boost { namespace fusion
|
||||
inline typename apply<Sequence const, T>::type
|
||||
operator()(Sequence const& seq, T const& x) const
|
||||
{
|
||||
typedef joint_view<Sequence const, single_view<T> > result;
|
||||
single_view<T> val(x);
|
||||
return result(seq, val);
|
||||
typedef append_view<Sequence const, T> result;
|
||||
return result(seq, x);
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
inline typename apply<Sequence, T>::type
|
||||
operator()(Sequence& seq, T const& x) const
|
||||
{
|
||||
typedef joint_view<Sequence, single_view<T> > result;
|
||||
single_view<T> val(x);
|
||||
return result(seq, val);
|
||||
typedef append_view<Sequence, T> result;
|
||||
return result(seq, x);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -38,7 +39,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
return filter_view<
|
||||
Sequence const
|
||||
, mpl::not_<is_same<mpl::_, typename T::type>
|
||||
, mpl::not_<is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type>
|
||||
> >(seq);
|
||||
}
|
||||
|
||||
@@ -50,7 +51,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
return filter_view<
|
||||
Sequence
|
||||
, mpl::not_<is_same<mpl::_, typename T::type>
|
||||
, mpl::not_<is_same<mpl::_, BOOST_DEDUCED_TYPENAME T::type>
|
||||
> >(seq);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -25,8 +26,9 @@ namespace boost { namespace fusion
|
||||
typedef typename meta::begin<Sequence>::type first_type;
|
||||
typedef typename meta::end<Sequence>::type last_type;
|
||||
typedef typename meta::next<Position>::type next_type;
|
||||
#if! BOOST_WORKAROUND(BOOST_MSVC,<=1300)
|
||||
BOOST_STATIC_ASSERT((!meta::equal_to<Position, last_type>::value));
|
||||
|
||||
#endif
|
||||
typedef single_view<T> insert_type;
|
||||
typedef range<first_type, Position> left_type;
|
||||
typedef range<next_type, last_type> right_type;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -11,6 +12,9 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,==1200)
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#endif
|
||||
|
||||
#if (defined(BOOST_MSVC) && (BOOST_MSVC < 1310)) \
|
||||
|| (defined(__BORLANDC__) && (__BORLANDC__ <= 0x570)) \
|
||||
@@ -58,7 +62,7 @@ namespace boost { namespace fusion { namespace borland_only {
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1301) && !defined(NDEBUG)
|
||||
# define FUSION_RETURN_DEFAULT_CONSTRUCTED type r; return r
|
||||
# define FUSION_RETURN_DEFAULT_CONSTRUCTED type r=type(); return r
|
||||
#else
|
||||
# define FUSION_RETURN_DEFAULT_CONSTRUCTED return type()
|
||||
#endif
|
||||
@@ -141,7 +145,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// VC6 ETI (early template instantiation) bug workaround.
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
#define FUSION_MSVC_ETI_WRAPPER(name) \
|
||||
namespace boost { namespace fusion { namespace detail \
|
||||
{ \
|
||||
@@ -158,7 +162,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
}; \
|
||||
}}}
|
||||
#endif
|
||||
|
||||
/*
|
||||
// is_msvc_70_ETI_arg: Detect a VC7 ETI arg
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
@@ -215,7 +219,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
::template result<T> {}; \
|
||||
}}}
|
||||
#endif
|
||||
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// T::tag wrapper
|
||||
@@ -300,6 +304,110 @@ FUSION_MSVC_ETI_WRAPPER(value_type)
|
||||
# define FUSION_GET_VALUE_TYPE(T) typename T::value_type
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
|
||||
namespace boost {namespace fusion { namespace aux {
|
||||
template< typename T >
|
||||
struct msvc_never_true
|
||||
{
|
||||
enum { value = false };
|
||||
};
|
||||
}}} //namespace boost::fusion::aux
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost {namespace fusion {
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
|
||||
namespace aux {
|
||||
// msvc_apply
|
||||
#define AUX778076_MSVC_DTW_NAME msvc_apply1
|
||||
#define AUX778076_MSVC_DTW_ORIGINAL_NAME apply
|
||||
#define AUX778076_MSVC_DTW_ARITY 1
|
||||
#include "boost/mpl/aux_/msvc_dtw.hpp"
|
||||
|
||||
#define AUX778076_MSVC_DTW_NAME msvc_apply2
|
||||
#define AUX778076_MSVC_DTW_ORIGINAL_NAME apply
|
||||
#define AUX778076_MSVC_DTW_ARITY 2
|
||||
#include "boost/mpl/aux_/msvc_dtw.hpp"
|
||||
|
||||
} //namespace aux
|
||||
|
||||
template<typename A,typename B>
|
||||
struct fusion_apply1
|
||||
{
|
||||
typedef typename aux::msvc_apply1<A>::template result_<B>::type type;
|
||||
};
|
||||
|
||||
template<typename A,typename B,typename C>
|
||||
struct fusion_apply2
|
||||
{
|
||||
typedef typename aux::msvc_apply2<A>::template result_<B,C>::type type;
|
||||
};
|
||||
|
||||
#else
|
||||
template<typename A,typename B>
|
||||
struct fusion_apply1
|
||||
{
|
||||
typedef typename A::template apply<B>::type type;
|
||||
};
|
||||
template<typename A,typename B,typename C>
|
||||
struct fusion_apply2
|
||||
{
|
||||
typedef typename A::template apply<B,C>::type type;
|
||||
};
|
||||
#endif
|
||||
}} //namespace boost::fusion
|
||||
|
||||
namespace boost {namespace fusion {namespace detail {
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
template<typename T>
|
||||
struct bool_base {};
|
||||
template<>
|
||||
struct bool_base<mpl::bool_<true> > : boost::mpl::bool_<true>{};
|
||||
template<>
|
||||
struct bool_base<mpl::bool_<false> > : boost::mpl::bool_<false>{};
|
||||
#else
|
||||
template<typename T>
|
||||
struct bool_base : T {};
|
||||
#endif
|
||||
}}}
|
||||
|
||||
//VC 6 has serious problems with mpl::int_ in tuple_iterator_base.
|
||||
//It ICEs because operator int() const on mpl::int_ is inlined.
|
||||
//At the same time, another test using integral_c<T,N> ICEs because operator int() is not inlined.
|
||||
//Only solution seems to be to define a special msvc_fusion_int for VC 6 to be used in tuple_iterator_base
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
namespace boost {namespace fusion {namespace detail{
|
||||
|
||||
template<int N>
|
||||
struct msvc_fusion_int
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, value = N);
|
||||
typedef msvc_fusion_int<N> type;
|
||||
typedef int value_type;
|
||||
typedef boost::mpl::integral_c_tag tag;
|
||||
|
||||
typedef msvc_fusion_int<value + 1> next;
|
||||
typedef msvc_fusion_int<value - 1> prior;
|
||||
|
||||
operator int() const;
|
||||
};
|
||||
|
||||
template<int N>
|
||||
msvc_fusion_int<N>::operator int() const
|
||||
{
|
||||
return static_cast<int>(this->value);
|
||||
}
|
||||
|
||||
}}}
|
||||
#define FUSION_INT(N) boost::fusion::detail::msvc_fusion_int<N>
|
||||
#else
|
||||
#define FUSION_INT(N) boost::mpl::int_<N>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Borland is so flaky with const correctness of iterators. It's getting
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -18,6 +19,22 @@ namespace boost { namespace fusion
|
||||
// Test T. If it is a fusion iterator, return a reference to it.
|
||||
// else, assume it is an mpl iterator.
|
||||
|
||||
namespace as_fusion_iterator_detail {
|
||||
template <typename T>
|
||||
static T const&
|
||||
convert(T const& x, mpl::true_)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static type_sequence_iterator<T>
|
||||
convert(T const& x, mpl::false_)
|
||||
{
|
||||
return type_sequence_iterator<T>();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct as_fusion_iterator
|
||||
{
|
||||
@@ -29,29 +46,27 @@ namespace boost { namespace fusion
|
||||
>::type
|
||||
type;
|
||||
|
||||
static T const&
|
||||
convert(T const& x, mpl::true_)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
static type_sequence_iterator<T>
|
||||
convert(T const& x, mpl::false_)
|
||||
{
|
||||
return type_sequence_iterator<T>();
|
||||
}
|
||||
|
||||
static typename
|
||||
mpl::if_<
|
||||
fusion::is_iterator<T>
|
||||
, T const&
|
||||
, type_sequence_iterator<T>
|
||||
>::type
|
||||
convert(T const& x)
|
||||
{
|
||||
return convert(x, fusion::is_iterator<T>());
|
||||
}
|
||||
convert(T const& x);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
typename
|
||||
mpl::if_<
|
||||
fusion::is_iterator<T>
|
||||
, T const&
|
||||
, type_sequence_iterator<T>
|
||||
>::type
|
||||
as_fusion_iterator<T>::convert(T const& x)
|
||||
{
|
||||
return as_fusion_iterator_detail::convert(x, fusion::is_iterator<T>());
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
57
include/boost/spirit/fusion/iterator/cons_iterator.hpp
Executable file
57
include/boost/spirit/fusion/iterator/cons_iterator.hpp
Executable file
@@ -0,0 +1,57 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ITERATOR_CONS_ITERATOR_HPP)
|
||||
#define FUSION_ITERATOR_CONS_ITERATOR_HPP
|
||||
|
||||
#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp>
|
||||
#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp>
|
||||
#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp>
|
||||
#include <boost/spirit/fusion/iterator/detail/cons_iterator/deref_traits.hpp>
|
||||
#include <boost/spirit/fusion/iterator/detail/cons_iterator/next_traits.hpp>
|
||||
#include <boost/spirit/fusion/iterator/detail/cons_iterator/value_traits.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct nil;
|
||||
|
||||
struct cons_iterator_tag;
|
||||
|
||||
template <typename Cons = nil>
|
||||
struct cons_iterator : iterator_base<cons_iterator<Cons> >
|
||||
{
|
||||
typedef cons_iterator_tag tag;
|
||||
typedef Cons cons_type;
|
||||
|
||||
explicit cons_iterator(cons_type& cons_)
|
||||
: cons(cons_) {}
|
||||
|
||||
cons_type& cons;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct cons_iterator<nil> : iterator_base<cons_iterator<nil> >
|
||||
{
|
||||
typedef cons_iterator_tag tag;
|
||||
typedef nil cons_type;
|
||||
cons_iterator() {}
|
||||
explicit cons_iterator(nil const&) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct cons_iterator<nil const> : iterator_base<cons_iterator<nil const> >
|
||||
{
|
||||
typedef cons_iterator_tag tag;
|
||||
typedef nil const cons_type;
|
||||
cons_iterator() {}
|
||||
explicit cons_iterator(nil const&) {}
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -12,6 +13,7 @@
|
||||
#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp>
|
||||
#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@@ -37,30 +39,44 @@ namespace boost { namespace fusion
|
||||
};
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
typename meta::deref<Iterator>::type
|
||||
deref(Iterator const& i)
|
||||
{
|
||||
typedef as_fusion_iterator<Iterator> converter;
|
||||
typedef typename converter::type iter;
|
||||
namespace deref_detail {
|
||||
template <typename Iterator>
|
||||
typename meta::deref<Iterator>::type
|
||||
deref(Iterator const& i,mpl::true_)
|
||||
{
|
||||
typedef as_fusion_iterator<Iterator> converter;
|
||||
typedef typename converter::type iter;
|
||||
|
||||
typename meta::deref<iter>::type result =
|
||||
meta::deref_impl<FUSION_GET_TAG(iter)>::
|
||||
template apply<iter>::call(converter::convert(i));
|
||||
return result;
|
||||
typename meta::deref<iter>::type result =
|
||||
meta::deref_impl<FUSION_GET_TAG(iter)>::
|
||||
template apply<iter>::call(converter::convert(i));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
inline typename meta::deref<Iterator>::type
|
||||
deref(Iterator& i,mpl::false_)
|
||||
{
|
||||
typedef as_fusion_iterator<Iterator> converter;
|
||||
typedef typename converter::type iter;
|
||||
|
||||
typename meta::deref<iter>::type result =
|
||||
meta::deref_impl<FUSION_GET_TAG(iter)>::
|
||||
template apply<iter>::call(converter::convert(i));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
inline typename meta::deref<Iterator>::type
|
||||
deref(Iterator& i)
|
||||
{
|
||||
typedef as_fusion_iterator<Iterator> converter;
|
||||
typedef typename converter::type iter;
|
||||
typename meta::deref<Iterator>::type
|
||||
deref(Iterator& i) {
|
||||
return deref_detail::deref(i,is_const<Iterator>());
|
||||
}
|
||||
|
||||
typename meta::deref<iter>::type result =
|
||||
meta::deref_impl<FUSION_GET_TAG(iter)>::
|
||||
template apply<iter>::call(converter::convert(i));
|
||||
return result;
|
||||
template <typename Iterator>
|
||||
typename meta::deref<Iterator>::type
|
||||
deref(Iterator const & i) {
|
||||
return deref_detail::deref(i,is_const<Iterator const>());
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -12,22 +13,31 @@
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
struct adapt_deref_traits
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
namespace adapt_deref_detail {
|
||||
template<typename Iterator>
|
||||
struct deref_traits_impl
|
||||
{
|
||||
typedef typename
|
||||
meta::deref<typename Iterator::first_type>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return *i.first;
|
||||
}
|
||||
};
|
||||
call(Iterator const& i);
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
typename deref_traits_impl<Iterator>::type
|
||||
deref_traits_impl<Iterator>::call(Iterator const& i)
|
||||
{
|
||||
return *i.first;
|
||||
}
|
||||
}
|
||||
struct adapt_deref_traits {
|
||||
template<typename Iterator>
|
||||
struct apply : adapt_deref_detail::deref_traits_impl<Iterator>
|
||||
{};
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
60
include/boost/spirit/fusion/iterator/detail/cons_iterator/deref_traits.hpp
Executable file
60
include/boost/spirit/fusion/iterator/detail/cons_iterator/deref_traits.hpp
Executable file
@@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ITERATOR_DETAIL_CONS_ITERATOR_DEREF_TRAITS_HPP)
|
||||
#define FUSION_ITERATOR_DETAIL_CONS_ITERATOR_DEREF_TRAITS_HPP
|
||||
|
||||
#include <boost/spirit/fusion/detail/config.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct cons_iterator_tag;
|
||||
|
||||
namespace cons_detail
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct deref_traits_impl
|
||||
{
|
||||
typedef typename Iterator::cons_type cons_type;
|
||||
typedef typename cons_type::car_type value_type;
|
||||
|
||||
typedef typename mpl::eval_if<
|
||||
is_const<cons_type>
|
||||
, add_reference<typename add_const<value_type>::type>
|
||||
, add_reference<value_type> >::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return detail::ref(i.cons.car);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
struct deref_impl;
|
||||
|
||||
template <>
|
||||
struct deref_impl<cons_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply : cons_detail::deref_traits_impl<Iterator> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
68
include/boost/spirit/fusion/iterator/detail/cons_iterator/next_traits.hpp
Executable file
68
include/boost/spirit/fusion/iterator/detail/cons_iterator/next_traits.hpp
Executable file
@@ -0,0 +1,68 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ITERATOR_DETAIL_CONS_ITERATOR_NEXT_TRAITS_HPP)
|
||||
#define FUSION_ITERATOR_DETAIL_CONS_ITERATOR_NEXT_TRAITS_HPP
|
||||
|
||||
#include <boost/spirit/fusion/detail/config.hpp>
|
||||
#include <boost/spirit/fusion/iterator/next.hpp>
|
||||
#include <boost/spirit/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct cons_iterator_tag;
|
||||
|
||||
template <typename Cons>
|
||||
struct cons_iterator;
|
||||
|
||||
namespace cons_detail
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct next_traits_impl
|
||||
{
|
||||
typedef typename Iterator::cons_type cons_type;
|
||||
typedef typename cons_type::cdr_type cdr_type;
|
||||
|
||||
typedef cons_iterator<
|
||||
typename mpl::eval_if<
|
||||
is_const<cons_type>
|
||||
, add_const<cdr_type>
|
||||
, mpl::identity<cdr_type>
|
||||
>::type>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(detail::ref(i.cons.cdr));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
struct next_impl;
|
||||
|
||||
template <>
|
||||
struct next_impl<cons_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply : cons_detail::next_traits_impl<Iterator> {};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
45
include/boost/spirit/fusion/iterator/detail/cons_iterator/value_traits.hpp
Executable file
45
include/boost/spirit/fusion/iterator/detail/cons_iterator/value_traits.hpp
Executable file
@@ -0,0 +1,45 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ITERATOR_DETAIL_CONS_ITERATOR_VALUE_TRAITS_HPP)
|
||||
#define FUSION_ITERATOR_DETAIL_CONS_ITERATOR_VALUE_TRAITS_HPP
|
||||
|
||||
#include <boost/spirit/fusion/detail/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct cons_iterator_tag;
|
||||
|
||||
namespace cons_detail
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct value_traits_impl
|
||||
{
|
||||
typedef typename Iterator::cons_type cons_type;
|
||||
typedef typename cons_type::car_type type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
struct value_impl;
|
||||
|
||||
template <>
|
||||
struct value_impl<cons_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply : cons_detail::value_traits_impl<Iterator> {};
|
||||
};
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -21,8 +22,8 @@ namespace boost { namespace fusion
|
||||
struct deref_impl;
|
||||
|
||||
template <>
|
||||
struct deref_impl<filter_view_iterator_tag>
|
||||
: detail::adapt_deref_traits {};
|
||||
struct deref_impl<filter_view_iterator_tag> : detail::adapt_deref_traits
|
||||
{};
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -22,6 +23,40 @@ namespace boost { namespace fusion
|
||||
template <typename First, typename Last, typename Pred>
|
||||
struct filter_iterator;
|
||||
|
||||
namespace filter_view_detail {
|
||||
template<typename Iterator>
|
||||
struct next_traits_impl {
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename Iterator::last_type last_type;
|
||||
typedef typename Iterator::pred_type pred_type;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
meta::equal_to<first_type, last_type>
|
||||
, mpl::identity<last_type>
|
||||
, meta::next<first_type>
|
||||
>::type
|
||||
next_type;
|
||||
|
||||
typedef typename detail::static_find_if<
|
||||
next_type, last_type, pred_type>
|
||||
filter;
|
||||
|
||||
typedef filter_iterator<
|
||||
typename filter::type, last_type, pred_type>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i);
|
||||
};
|
||||
template<typename Iterator>
|
||||
typename next_traits_impl<Iterator>::type
|
||||
next_traits_impl<Iterator>::call(Iterator const& i)
|
||||
{
|
||||
return type(filter::call(i.first));
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
@@ -31,34 +66,8 @@ namespace boost { namespace fusion
|
||||
struct next_impl<filter_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename Iterator::last_type last_type;
|
||||
typedef typename Iterator::pred_type pred_type;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
meta::equal_to<first_type, last_type>
|
||||
, mpl::identity<last_type>
|
||||
, meta::next<first_type>
|
||||
>::type
|
||||
next_type;
|
||||
|
||||
typedef typename detail::static_find_if<
|
||||
next_type, last_type, pred_type>
|
||||
filter;
|
||||
|
||||
typedef filter_iterator<
|
||||
typename filter::type, last_type, pred_type>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(filter::call(i.first));
|
||||
}
|
||||
};
|
||||
struct apply : filter_view_detail::next_traits_impl<Iterator>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -16,17 +17,25 @@ namespace boost { namespace fusion
|
||||
struct iterator_base : iterator_root
|
||||
{
|
||||
Iterator const&
|
||||
cast() const
|
||||
{
|
||||
return static_cast<Iterator const&>(*this);
|
||||
}
|
||||
cast() const;
|
||||
|
||||
Iterator&
|
||||
cast()
|
||||
{
|
||||
return static_cast<Iterator&>(*this);
|
||||
}
|
||||
cast();
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
Iterator const&
|
||||
iterator_base<Iterator>::cast() const
|
||||
{
|
||||
return static_cast<Iterator const&>(*this);
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
Iterator&
|
||||
iterator_base<Iterator>::cast()
|
||||
{
|
||||
return static_cast<Iterator&>(*this);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -23,6 +24,50 @@ namespace boost { namespace fusion
|
||||
template <typename First, typename Last, typename Concat>
|
||||
struct joint_view_iterator;
|
||||
|
||||
namespace join_view_detail {
|
||||
template<typename Iterator>
|
||||
struct next_traits_impl {
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename Iterator::last_type last_type;
|
||||
typedef typename Iterator::concat_type concat_type;
|
||||
typedef typename meta::next<first_type>::type next_type;
|
||||
typedef meta::equal_to<next_type, last_type> equal_to;
|
||||
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
equal_to
|
||||
, concat_type
|
||||
, joint_view_iterator<next_type, last_type, concat_type>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i);
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
typename next_traits_impl<Iterator>::type
|
||||
call(Iterator const& i, mpl::true_)
|
||||
{
|
||||
return i.concat;
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
typename next_traits_impl<Iterator>::type
|
||||
call(Iterator const& i, mpl::false_)
|
||||
{
|
||||
typedef typename next_traits_impl<Iterator>::type type;
|
||||
return type(fusion::next(i.first), i.concat);
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
typename next_traits_impl<Iterator>::type
|
||||
next_traits_impl<Iterator>::call(Iterator const& i)
|
||||
{
|
||||
return join_view_detail::call(i, equal_to());
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
@@ -32,40 +77,8 @@ namespace boost { namespace fusion
|
||||
struct next_impl<joint_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename Iterator::last_type last_type;
|
||||
typedef typename Iterator::concat_type concat_type;
|
||||
typedef typename meta::next<first_type>::type next_type;
|
||||
typedef meta::equal_to<next_type, last_type> equal_to;
|
||||
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
equal_to
|
||||
, concat_type
|
||||
, joint_view_iterator<next_type, last_type, concat_type>
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i, mpl::true_)
|
||||
{
|
||||
return i.concat;
|
||||
}
|
||||
|
||||
static type
|
||||
call(Iterator const& i, mpl::false_)
|
||||
{
|
||||
return type(fusion::next(i.first), i.concat);
|
||||
}
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return call(i, equal_to());
|
||||
}
|
||||
};
|
||||
struct apply : join_view_detail::next_traits_impl<Iterator>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -14,13 +14,29 @@
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <typename SingleView>
|
||||
struct single_view_access_result
|
||||
{
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_const<SingleView>
|
||||
, cref_result<mpl::identity<FUSION_GET_VALUE_TYPE(SingleView)> >
|
||||
, ref_result<mpl::identity<FUSION_GET_VALUE_TYPE(SingleView)> >
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
}
|
||||
|
||||
namespace single_view_iterator_detail
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct deref_traits_impl
|
||||
{
|
||||
typedef typename detail::cref_result<
|
||||
mpl::identity<FUSION_GET_VALUE_TYPE(Iterator)> >::type
|
||||
typedef typename Iterator::single_view_type single_view_type;
|
||||
typedef typename detail::single_view_access_result<
|
||||
single_view_type>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
@@ -31,7 +47,7 @@ namespace boost { namespace fusion
|
||||
inline typename deref_traits_impl<Iterator>::type
|
||||
deref_traits_impl<Iterator>::call(Iterator const& i)
|
||||
{
|
||||
return detail::ref(i.val);
|
||||
return detail::ref(i.view.val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -14,12 +15,33 @@ namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_iterator_tag;
|
||||
|
||||
template <typename T>
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator_end;
|
||||
|
||||
template <typename T>
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator;
|
||||
|
||||
namespace single_view_detail
|
||||
{
|
||||
template<typename Iterator>
|
||||
struct next_traits_impl
|
||||
{
|
||||
typedef single_view_iterator_end<
|
||||
typename Iterator::single_view_type>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator);
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
typename next_traits_impl<Iterator>::type
|
||||
next_traits_impl<Iterator>::call(Iterator)
|
||||
{
|
||||
FUSION_RETURN_DEFAULT_CONSTRUCTED;
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
@@ -29,18 +51,8 @@ namespace boost { namespace fusion
|
||||
struct next_impl<single_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef single_view_iterator_end<
|
||||
FUSION_GET_VALUE_TYPE(Iterator)>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Iterator)
|
||||
{
|
||||
FUSION_RETURN_DEFAULT_CONSTRUCTED;
|
||||
};
|
||||
};
|
||||
struct apply : single_view_detail::next_traits_impl<Iterator>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace boost { namespace fusion
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef FUSION_GET_VALUE_TYPE(Iterator) type;
|
||||
typedef typename Iterator::single_view_type single_view_type;
|
||||
typedef FUSION_GET_VALUE_TYPE(single_view_type) type;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -10,11 +11,34 @@
|
||||
|
||||
#include <boost/spirit/fusion/detail/config.hpp>
|
||||
#include <boost/spirit/fusion/iterator/deref.hpp>
|
||||
#include <boost/spirit/fusion/iterator/value_of.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct transform_view_iterator_tag;
|
||||
|
||||
namespace transform_view_detail {
|
||||
template<typename Iterator>
|
||||
struct deref_traits_impl {
|
||||
typedef typename
|
||||
meta::value_of<typename Iterator::first_type>::type
|
||||
value_type;
|
||||
|
||||
typedef typename Iterator::transform_type transform_type;
|
||||
typedef typename fusion_apply1<transform_type, value_type>::type type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i);
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
BOOST_DEDUCED_TYPENAME deref_traits_impl<Iterator>::type
|
||||
deref_traits_impl<Iterator>::call(Iterator const& i)
|
||||
{
|
||||
return i.f(*i.first);
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
@@ -24,22 +48,8 @@ namespace boost { namespace fusion
|
||||
struct deref_impl<transform_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
meta::deref<typename Iterator::first_type>::type
|
||||
deref_type;
|
||||
|
||||
typedef typename Iterator::transform_type transform_type;
|
||||
typedef typename transform_type::
|
||||
template apply<deref_type>::type type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return i.f(*i.first);
|
||||
}
|
||||
};
|
||||
struct apply : transform_view_detail::deref_traits_impl<Iterator>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -17,6 +18,26 @@ namespace boost { namespace fusion
|
||||
|
||||
template <typename First, typename F>
|
||||
struct transform_view_iterator;
|
||||
|
||||
namespace transform_view_detail {
|
||||
template <typename Iterator>
|
||||
struct next_traits_impl
|
||||
{
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename meta::next<first_type>::type next_type;
|
||||
typedef typename Iterator::transform_type transform_type;
|
||||
typedef transform_view_iterator<next_type, transform_type> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i);
|
||||
};
|
||||
template <typename Iterator>
|
||||
typename next_traits_impl<Iterator>::type
|
||||
next_traits_impl<Iterator>::call(Iterator const& i)
|
||||
{
|
||||
return type(fusion::next(i.first), i.f);
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
@@ -27,19 +48,8 @@ namespace boost { namespace fusion
|
||||
struct next_impl<transform_view_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef typename Iterator::first_type first_type;
|
||||
typedef typename meta::next<first_type>::type next_type;
|
||||
typedef typename Iterator::transform_type transform_type;
|
||||
typedef transform_view_iterator<next_type, transform_type> type;
|
||||
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(fusion::next(i.first), i.f);
|
||||
}
|
||||
};
|
||||
struct apply : transform_view_detail::next_traits_impl<Iterator>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -32,8 +33,7 @@ namespace boost { namespace fusion
|
||||
value_type;
|
||||
|
||||
typedef typename Iterator::transform_type transform_type;
|
||||
typedef typename transform_type::
|
||||
template apply<value_type>::type type;
|
||||
typedef typename fusion_apply1<transform_type,value_type>::type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -28,8 +29,9 @@ namespace boost { namespace fusion
|
||||
typedef FUSION_GET_INDEX(Iterator) index;
|
||||
typedef FUSION_GET_TUPLE(Iterator) tuple_;
|
||||
typedef FUSION_GET_SIZE(tuple_) size;
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300)
|
||||
BOOST_STATIC_ASSERT((::boost::mpl::less<index, size>::value));
|
||||
|
||||
#endif
|
||||
typedef typename mpl::next<index>::type next;
|
||||
typedef tuple_iterator<FUSION_GET_VALUE(next), tuple_> type;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -28,9 +29,11 @@ namespace boost { namespace fusion
|
||||
{
|
||||
typedef FUSION_GET_INDEX(Iterator) index;
|
||||
typedef FUSION_GET_TUPLE(Iterator) tuple_;
|
||||
typedef FUSION_INT(0) other_index;
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300)
|
||||
BOOST_STATIC_ASSERT((
|
||||
::boost::mpl::greater_equal<index, mpl::int_<0> >::value));
|
||||
|
||||
::boost::mpl::greater_equal<index, other_index >::value));
|
||||
#endif
|
||||
typedef typename mpl::prior<index>::type prior;
|
||||
typedef tuple_iterator<FUSION_GET_VALUE(prior), tuple_> type;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -18,6 +19,26 @@ namespace boost { namespace fusion
|
||||
template <typename Iterator>
|
||||
struct type_sequence_iterator;
|
||||
|
||||
namespace type_sequence_detail {
|
||||
template <typename Iterator>
|
||||
struct next_traits_impl
|
||||
{
|
||||
typedef type_sequence_iterator<
|
||||
typename mpl::next<typename Iterator::iterator_type>::type
|
||||
> type;
|
||||
|
||||
static type
|
||||
call(Iterator);
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
typename next_traits_impl<Iterator>::type
|
||||
next_traits_impl<Iterator>::call(Iterator)
|
||||
{
|
||||
FUSION_RETURN_DEFAULT_CONSTRUCTED;
|
||||
}
|
||||
}
|
||||
|
||||
namespace meta
|
||||
{
|
||||
template <typename Tag>
|
||||
@@ -27,18 +48,8 @@ namespace boost { namespace fusion
|
||||
struct next_impl<type_sequence_iterator_tag>
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct apply
|
||||
{
|
||||
typedef type_sequence_iterator<
|
||||
typename mpl::next<typename Iterator::iterator_type>::type
|
||||
> type;
|
||||
|
||||
static type
|
||||
call(Iterator)
|
||||
{
|
||||
FUSION_RETURN_DEFAULT_CONSTRUCTED;
|
||||
};
|
||||
};
|
||||
struct apply : type_sequence_detail::next_traits_impl<Iterator>
|
||||
{};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -35,11 +36,13 @@ namespace boost { namespace fusion
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct equal_to
|
||||
: equal_to_impl<typename as_fusion_iterator<I1>::type::tag>::
|
||||
: detail::bool_base<
|
||||
typename equal_to_impl<typename as_fusion_iterator<I1>::type::tag>::
|
||||
template apply<
|
||||
typename as_fusion_iterator<I1>::type
|
||||
, typename as_fusion_iterator<I2>::type
|
||||
>::type {};
|
||||
>::type
|
||||
> {};
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -33,11 +34,15 @@ namespace boost { namespace fusion
|
||||
typedef last_iter last_type;
|
||||
typedef Pred pred_type;
|
||||
|
||||
filter_iterator(First const& first)
|
||||
: first(filter::call(first_converter::convert(first))) {}
|
||||
filter_iterator(First const& first);
|
||||
|
||||
first_type first;
|
||||
};
|
||||
|
||||
template <typename First, typename Last, typename Pred>
|
||||
filter_iterator<First,Last,Pred>::filter_iterator(First const& first)
|
||||
: first(filter::call(first_converter::convert(first)))
|
||||
{}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,10 +22,7 @@ namespace boost { namespace fusion
|
||||
// is_iterator<T>::value
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
namespace detail
|
||||
{
|
||||
struct iterator_root;
|
||||
}
|
||||
struct iterator_root;
|
||||
|
||||
template <typename T>
|
||||
struct is_iterator : is_base_and_derived<iterator_root, T> {};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -32,16 +33,21 @@ namespace boost { namespace fusion
|
||||
typedef typename concat_converter::type concat_type;
|
||||
|
||||
typedef joint_view_iterator_tag tag;
|
||||
#if! BOOST_WORKAROUND(BOOST_MSVC,<=1300)
|
||||
BOOST_STATIC_ASSERT((!meta::equal_to<first_type, last_type>::value));
|
||||
|
||||
joint_view_iterator(First const& first, Concat const& concat)
|
||||
: first(first_converter::convert(first))
|
||||
, concat(concat_converter::convert(concat))
|
||||
{}
|
||||
#endif
|
||||
joint_view_iterator(First const& first, Concat const& concat);
|
||||
|
||||
first_type first;
|
||||
concat_type concat;
|
||||
};
|
||||
template <typename First, typename Last, typename Concat>
|
||||
joint_view_iterator<First,Last,Concat>::joint_view_iterator(First const& first, Concat const& concat)
|
||||
: first(first_converter::convert(first))
|
||||
, concat(concat_converter::convert(concat))
|
||||
{}
|
||||
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -43,7 +44,7 @@ namespace boost { namespace fusion
|
||||
typedef typename converter::type iter;
|
||||
|
||||
return meta::prior_impl<FUSION_GET_TAG(iter)>::
|
||||
template apply<Iterator>::call(converter::convert(i));
|
||||
template apply<iter>::call(converter::convert(i));
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
@@ -19,27 +19,25 @@ namespace boost { namespace fusion
|
||||
{
|
||||
struct single_view_iterator_tag;
|
||||
|
||||
template <typename T>
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator_end
|
||||
: iterator_base<single_view_iterator_end<T> >
|
||||
: iterator_base<single_view_iterator_end<SingleView> >
|
||||
{
|
||||
typedef single_view_iterator_tag tag;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
template <typename SingleView>
|
||||
struct single_view_iterator
|
||||
: iterator_base<single_view_iterator<T> >
|
||||
: iterator_base<single_view_iterator<SingleView> >
|
||||
{
|
||||
typedef single_view_iterator_tag tag;
|
||||
typedef typename detail::as_tuple_element<T>::type value_type;
|
||||
typedef SingleView single_view_type;
|
||||
typedef typename add_reference<SingleView>::type reference_type;
|
||||
|
||||
single_view_iterator()
|
||||
: val() {}
|
||||
explicit single_view_iterator(reference_type view)
|
||||
: view(view) {}
|
||||
|
||||
explicit single_view_iterator(typename detail::call_param<T>::type val)
|
||||
: val(val) {}
|
||||
|
||||
value_type val;
|
||||
reference_type view;
|
||||
};
|
||||
}}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Joel de Guzman
|
||||
Copyright (c) 2004 Peder Holt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -27,12 +28,16 @@ namespace boost { namespace fusion
|
||||
typedef typename converter::type first_type;
|
||||
typedef F transform_type;
|
||||
|
||||
transform_view_iterator(First const& first, F f)
|
||||
: first(converter::convert(first)), f(f) {}
|
||||
transform_view_iterator(First const& first, F f);
|
||||
|
||||
first_type first;
|
||||
transform_type f;
|
||||
};
|
||||
|
||||
template <typename First, typename F>
|
||||
transform_view_iterator<First,F>::transform_view_iterator(First const& first, F f)
|
||||
: first(converter::convert(first)), f(f) {}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user