Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / doc / html / structboost_1_1hana_1_1default__.html
1 <!--
2 Copyright Louis Dionne 2013-2017
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
5 -->
6 <!-- boost-no-inspect -->
7 <!-- HTML header for doxygen 1.8.9.1-->
8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
9 <html xmlns="http://www.w3.org/1999/xhtml">
10 <head>
11 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
12 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
13 <meta name="generator" content="Doxygen 1.8.11"/>
14 <title>Boost.Hana: boost::hana::default_ Struct Reference</title>
15 <link href="tabs.css" rel="stylesheet" type="text/css"/>
16 <script type="text/javascript" src="jquery.js"></script>
17 <script type="text/javascript" src="dynsections.js"></script>
18 <link href="navtree.css" rel="stylesheet" type="text/css"/>
19 <script type="text/javascript" src="resize.js"></script>
20 <script type="text/javascript" src="navtreedata.js"></script>
21 <script type="text/javascript" src="navtree.js"></script>
22 <script type="text/javascript">
23   $(document).ready(initResizable);
24   $(window).load(resizeHeight);
25 </script>
26 <link href="search/search.css" rel="stylesheet" type="text/css"/>
27 <script type="text/javascript" src="search/searchdata.js"></script>
28 <script type="text/javascript" src="search/search.js"></script>
29 <script type="text/javascript">
30   $(document).ready(function() { init_search(); });
31 </script>
32 <script type="text/x-mathjax-config">
33   MathJax.Hub.Config({
34     extensions: ["tex2jax.js"],
35     jax: ["input/TeX","output/HTML-CSS"],
36 });
37 // Copyright Louis Dionne 2013-2017
38 // Distributed under the Boost Software License, Version 1.0.
39 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
40 MathJax.Hub.Config({
41     "HTML-CSS": {
42         linebreaks: {
43             automatic: true,
44             width: "75% container"
45         }
46     }
47 });
48 </script><script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
49 <link href="doxygen.css" rel="stylesheet" type="text/css" />
50 <!-- Additional javascript for drawing charts. -->
51 <script type="text/javascript" src="highcharts.js"></script>
52 <script type="text/javascript" src="highcharts-data.js"></script>
53 <script type="text/javascript" src="highcharts-exporting.js"></script>
54 <script type="text/javascript" src="chart.js"></script>
55 <script type="text/javascript" src="hana.js"></script>
56 </head>
57 <body>
58 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
59 <div id="titlearea">
60 <table cellspacing="0" cellpadding="0">
61  <tbody>
62  <tr style="height: 56px;">
63   <td id="projectlogo"><img alt="Logo" src="Boost.png"/></td>
64   <td style="padding-left: 0.5em;">
65    <div id="projectname">Boost.Hana
66    &#160;<span id="projectnumber">1.1.0</span>
67    </div>
68    <div id="projectbrief">Your standard library for metaprogramming</div>
69   </td>
70    <td>        <div id="MSearchBox" class="MSearchBoxInactive">
71         <span class="left">
72           <img id="MSearchSelect" src="search/mag_sel.png"
73                onmouseover="return searchBox.OnSearchSelectShow()"
74                onmouseout="return searchBox.OnSearchSelectHide()"
75                alt=""/>
76           <input type="text" id="MSearchField" value="Search" accesskey="S"
77                onfocus="searchBox.OnSearchFieldFocus(true)" 
78                onblur="searchBox.OnSearchFieldFocus(false)" 
79                onkeyup="searchBox.OnSearchFieldChange(event)"/>
80           </span><span class="right">
81             <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
82           </span>
83         </div>
84 </td>
85  </tr>
86  </tbody>
87 </table>
88 </div>
89 <!-- end header part -->
90 <!-- Generated by Doxygen 1.8.11 -->
91 <script type="text/javascript">
92 var searchBox = new SearchBox("searchBox", "search",false,'Search');
93 </script>
94 </div><!-- top -->
95 <div id="side-nav" class="ui-resizable side-nav-resizable">
96   <div id="nav-tree">
97     <div id="nav-tree-contents">
98       <div id="nav-sync" class="sync"></div>
99     </div>
100   </div>
101   <div id="splitbar" style="-moz-user-select:none;" 
102        class="ui-resizable-handle">
103   </div>
104 </div>
105 <script type="text/javascript">
106 $(document).ready(function(){initNavTree('structboost_1_1hana_1_1default__.html','');});
107 </script>
108 <div id="doc-content">
109 <!-- window showing the filter options -->
110 <div id="MSearchSelectWindow"
111      onmouseover="return searchBox.OnSearchSelectShow()"
112      onmouseout="return searchBox.OnSearchSelectHide()"
113      onkeydown="return searchBox.OnSearchSelectKey(event)">
114 </div>
115
116 <!-- iframe showing the search results (closed by default) -->
117 <div id="MSearchResultsWindow">
118 <iframe src="javascript:void(0)" frameborder="0" 
119         name="MSearchResults" id="MSearchResults">
120 </iframe>
121 </div>
122
123 <div class="header">
124   <div class="headertitle">
125 <div class="title">boost::hana::default_ Struct Reference<div class="ingroups"><a class="el" href="group__group-core.html">Core</a></div></div>  </div>
126 </div><!--header-->
127 <div class="contents">
128 <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
129 <div class="textblock"><p>Mark a tag-dispatched method implementation as a default implementation. </p>
130 <p>When defining a new concept with tag-dispatched methods, it is sometimes possible to provide a default implementation for some method(s). Making <code><a class="el" href="structboost_1_1hana_1_1default__.html" title="Mark a tag-dispatched method implementation as a default implementation. ">default_</a></code> a base class of such a default implementation makes it possible to detect whether the method was dispatched to the default implementation afterwards.</p>
131 <h2>Example </h2>
132 <div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div><div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div><div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="core_2default_8hpp.html">boost/hana/core/default.hpp</a>&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="core_2tag__of_8hpp.html">boost/hana/core/tag_of.hpp</a>&gt;</span></div><div class="line"></div><div class="line"><span class="preprocessor">#include &lt;algorithm&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;iterator&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;sstream&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div><div class="line"></div><div class="line"></div><div class="line"><span class="comment">// In the header defining the concept of a Printable</span></div><div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><span class="keyword">struct </span>print_impl : hana::default_ {</div><div class="line">    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Stream, <span class="keyword">typename</span> X&gt;</div><div class="line">    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__group-functional.html#ga30027c383676084be151ef3c6cf2829f">apply</a>(Stream&amp; out, X <span class="keyword">const</span>&amp; x)</div><div class="line">    { out &lt;&lt; x; }</div><div class="line">};</div><div class="line"></div><div class="line"><span class="keyword">auto</span> <a class="code" href="group__group-experimental.html#ga660c0769106006a86948b5b355fad050">print</a> = [](<span class="keyword">auto</span>&amp; stream, <span class="keyword">auto</span> <span class="keyword">const</span>&amp; x) {</div><div class="line">    <span class="keywordflow">return</span> print_impl&lt;hana::tag_of_t&lt;decltype(x)&gt;&gt;<a class="code" href="group__group-functional.html#ga30027c383676084be151ef3c6cf2829f">::apply</a>(stream, x);</div><div class="line">};</div><div class="line"></div><div class="line"><span class="comment">// In some other header</span></div><div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><span class="keyword">struct </span>print_impl&lt;<a class="code" href="namespacestd.html">std</a>::vector&lt;T&gt;&gt; {</div><div class="line">    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Stream&gt;</div><div class="line">    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="group__group-functional.html#ga30027c383676084be151ef3c6cf2829f">apply</a>(Stream&amp; out, std::vector&lt;T&gt; <span class="keyword">const</span>&amp; xs) {</div><div class="line">        out &lt;&lt; <span class="charliteral">&#39;[&#39;</span>;</div><div class="line">        std::copy(begin(xs), end(xs), std::ostream_iterator&lt;T&gt;{out, <span class="stringliteral">&quot;, &quot;</span>});</div><div class="line">        out &lt;&lt; <span class="charliteral">&#39;]&#39;</span>;</div><div class="line">    }</div><div class="line">};</div><div class="line"></div><div class="line">static_assert(hana::is_default&lt;print_impl&lt;int&gt;&gt;{}, <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">static_assert(!hana::is_default&lt;print_impl&lt;std::vector&lt;int&gt;&gt;&gt;{}, <span class="stringliteral">&quot;&quot;</span>);</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main() {</div><div class="line">    {</div><div class="line">        std::stringstream s;</div><div class="line">        <a class="code" href="group__group-experimental.html#ga660c0769106006a86948b5b355fad050">print</a>(s, std::vector&lt;int&gt;{1, 2, 3});</div><div class="line">        <a class="code" href="group__group-assertions.html#ga29b2b21ffa5513e5b706c50ffee980af">BOOST_HANA_RUNTIME_CHECK</a>(s.str() == <span class="stringliteral">&quot;[1, 2, 3, ]&quot;</span>);</div><div class="line">    }</div><div class="line"></div><div class="line">    {</div><div class="line">        std::stringstream s;</div><div class="line">        <a class="code" href="group__group-experimental.html#ga660c0769106006a86948b5b355fad050">print</a>(s, <span class="stringliteral">&quot;abcd&quot;</span>);</div><div class="line">        <a class="code" href="group__group-assertions.html#ga29b2b21ffa5513e5b706c50ffee980af">BOOST_HANA_RUNTIME_CHECK</a>(s.str() == <span class="stringliteral">&quot;abcd&quot;</span>);</div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --> </div>
133 <p>Inherited by boost::hana::accessors_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::adjust_if_impl&lt; Fun, when&lt; condition &gt; &gt;, boost::hana::adjust_impl&lt; Fun, when&lt; condition &gt; &gt;, boost::hana::all_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::all_of_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::and_impl&lt; L, when&lt; condition &gt; &gt;, boost::hana::any_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::any_of_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::ap_impl&lt; A, when&lt; condition &gt; &gt;, boost::hana::append_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::at_impl&lt; It, when&lt; condition &gt; &gt;, boost::hana::at_key_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::back_impl&lt; It, when&lt; condition &gt; &gt;, boost::hana::cartesian_product_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::chain_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::concat_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::contains_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::count_if_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::count_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::cycle_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::difference_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::div_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::drop_back_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::drop_front_exactly_impl&lt; It, when&lt; condition &gt; &gt;, boost::hana::drop_front_impl&lt; It, when&lt; condition &gt; &gt;, boost::hana::drop_while_impl&lt; It, when&lt; condition &gt; &gt;, boost::hana::duplicate_impl&lt; W, when&lt; condition &gt; &gt;, boost::hana::empty_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::equal_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::erase_key_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::eval_if_impl&lt; L, when&lt; condition &gt; &gt;, boost::hana::eval_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::extend_impl&lt; W, when&lt; condition &gt; &gt;, boost::hana::extract_impl&lt; W, when&lt; condition &gt; &gt;, boost::hana::fill_impl&lt; Fun, when&lt; condition &gt; &gt;, boost::hana::filter_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::find_if_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::find_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::first_impl&lt; P, when&lt; condition &gt; &gt;, boost::hana::flatten_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::fold_left_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::fold_right_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::for_each_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::front_impl&lt; It, when&lt; condition &gt; &gt;, boost::hana::greater_equal_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::greater_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::group_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::hash_impl&lt; Tag, when&lt; condition &gt; &gt;, boost::hana::if_impl&lt; L, when&lt; condition &gt; &gt;, boost::hana::insert_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::intersection_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::intersperse_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::is_disjoint_impl&lt; S1, S2, when&lt; condition &gt; &gt;, boost::hana::is_empty_impl&lt; It, when&lt; condition &gt; &gt;, boost::hana::is_subset_impl&lt; S1, S2, when&lt; condition &gt; &gt;, boost::hana::keys_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::length_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::less_equal_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::less_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::lexicographical_compare_impl&lt; It, when&lt; condition &gt; &gt;, boost::hana::lift_impl&lt; A, when&lt; condition &gt; &gt;, boost::hana::make_impl&lt; Datatype, when&lt; condition &gt; &gt;, boost::hana::max_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::maximum_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::maximum_pred_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::members_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::min_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::minimum_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::minimum_pred_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::minus_impl&lt; T, T, when&lt; condition &gt; &gt;, boost::hana::minus_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::mod_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::monadic_fold_left_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::monadic_fold_right_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::mult_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::negate_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::none_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::none_of_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::not_equal_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::not_impl&lt; L, when&lt; condition &gt; &gt;, boost::hana::one_impl&lt; R, when&lt; condition &gt; &gt;, boost::hana::or_impl&lt; L, when&lt; condition &gt; &gt;, boost::hana::partition_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::permutations_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::plus_impl&lt; T, U, when&lt; condition &gt; &gt;, boost::hana::power_impl&lt; R, when&lt; condition &gt; &gt;, boost::hana::prefix_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::prepend_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::product_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::remove_at_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::remove_if_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::remove_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::remove_range_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::repeat_impl&lt; I, when&lt; condition &gt; &gt;, boost::hana::replace_if_impl&lt; Fun, when&lt; condition &gt; &gt;, boost::hana::replace_impl&lt; Fun, when&lt; condition &gt; &gt;, boost::hana::replicate_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::reverse_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::scan_left_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::scan_right_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::second_impl&lt; P, when&lt; condition &gt; &gt;, boost::hana::slice_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::sort_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::span_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::suffix_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::sum_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::symmetric_difference_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::take_back_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::take_front_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::take_while_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::tap_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::then_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::transform_impl&lt; Fun, when&lt; condition &gt; &gt;, boost::hana::unfold_left_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::unfold_right_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::union_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::unique_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::unpack_impl&lt; T, when&lt; condition &gt; &gt;, boost::hana::value_impl&lt; C, when&lt; condition &gt; &gt;, boost::hana::while_impl&lt; L, hana::when&lt; condition &gt; &gt;, boost::hana::zero_impl&lt; M, when&lt; condition &gt; &gt;, boost::hana::zip_impl&lt; S, when&lt; condition &gt; &gt;, boost::hana::zip_shortest_impl&lt; S, when&lt; condition &gt; &gt;, and boost::hana::zip_shortest_with_impl&lt; S, when&lt; condition &gt; &gt;.</p>
134 </div><!-- contents -->
135 </div><!-- doc-content -->
136 <!--
137 Copyright Louis Dionne 2013-2017
138 Distributed under the Boost Software License, Version 1.0.
139 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
140 -->
141 <!-- boost-no-inspect -->
142 <!-- HTML footer for doxygen 1.8.9.1-->
143 <!-- start footer part -->
144 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
145   <ul>
146     <li class="navelem"><a class="el" href="namespaceboost.html">boost</a></li><li class="navelem"><a class="el" href="namespaceboost_1_1hana.html">hana</a></li><li class="navelem"><a class="el" href="structboost_1_1hana_1_1default__.html">default_</a></li>
147   </ul>
148 </div>
149 </body>
150 </html>