123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <!--
- Copyright Louis Dionne 2013-2017
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
- -->
- <!-- boost-no-inspect -->
- <!-- HTML header for doxygen 1.8.9.1-->
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=9"/>
- <meta name="generator" content="Doxygen 1.8.15"/>
- <title>Boost.Hana: boost::hana::default_ Struct Reference</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="dynsections.js"></script>
- <link href="navtree.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="resize.js"></script>
- <script type="text/javascript" src="navtreedata.js"></script>
- <script type="text/javascript" src="navtree.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(document).ready(initResizable);
- /* @license-end */</script>
- <link href="search/search.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="search/searchdata.js"></script>
- <script type="text/javascript" src="search/search.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(document).ready(function() { init_search(); });
- /* @license-end */
- </script>
- <script type="text/x-mathjax-config">
- MathJax.Hub.Config({
- extensions: ["tex2jax.js"],
- jax: ["input/TeX","output/HTML-CSS"],
- });
- // Copyright Louis Dionne 2013-2017
- // Distributed under the Boost Software License, Version 1.0.
- // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
- MathJax.Hub.Config({
- "HTML-CSS": {
- linebreaks: {
- automatic: true,
- width: "75% container"
- }
- }
- });
- </script><script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- <!-- Additional javascript for drawing charts. -->
- <script type="text/javascript" src="highcharts.js"></script>
- <script type="text/javascript" src="highcharts-data.js"></script>
- <script type="text/javascript" src="highcharts-exporting.js"></script>
- <script type="text/javascript" src="chart.js"></script>
- <script type="text/javascript" src="hana.js"></script>
- </head>
- <body>
- <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
- <div id="titlearea">
- <table cellspacing="0" cellpadding="0">
- <tbody>
- <tr style="height: 56px;">
- <td id="projectlogo"><img alt="Logo" src="Boost.png"/></td>
- <td style="padding-left: 0.5em;">
- <div id="projectname">Boost.Hana
-  <span id="projectnumber">1.6.0</span>
- </div>
- <div id="projectbrief">Your standard library for metaprogramming</div>
- </td>
- <td> <div id="MSearchBox" class="MSearchBoxInactive">
- <span class="left">
- <img id="MSearchSelect" src="search/mag_sel.png"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- alt=""/>
- <input type="text" id="MSearchField" value="Search" accesskey="S"
- onfocus="searchBox.OnSearchFieldFocus(true)"
- onblur="searchBox.OnSearchFieldFocus(false)"
- onkeyup="searchBox.OnSearchFieldChange(event)"/>
- </span><span class="right">
- <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
- </span>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.15 -->
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- var searchBox = new SearchBox("searchBox", "search",false,'Search');
- /* @license-end */
- </script>
- </div><!-- top -->
- <div id="side-nav" class="ui-resizable side-nav-resizable">
- <div id="nav-tree">
- <div id="nav-tree-contents">
- <div id="nav-sync" class="sync"></div>
- </div>
- </div>
- <div id="splitbar" style="-moz-user-select:none;"
- class="ui-resizable-handle">
- </div>
- </div>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(document).ready(function(){initNavTree('structboost_1_1hana_1_1default__.html','');});
- /* @license-end */
- </script>
- <div id="doc-content">
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- </div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <iframe src="javascript:void(0)" frameborder="0"
- name="MSearchResults" id="MSearchResults">
- </iframe>
- </div>
- <div class="header">
- <div class="headertitle">
- <div class="title">boost::hana::default_ Struct Reference<div class="ingroups"><a class="el" href="group__group-core.html">Core</a></div></div> </div>
- </div><!--header-->
- <div class="contents">
- <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
- <div class="textblock"><p>Mark a tag-dispatched method implementation as a default implementation. </p>
- <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>
- <h2>Example </h2>
- <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 <<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="core_2default_8hpp.html">boost/hana/core/default.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="core_2tag__of_8hpp.html">boost/hana/core/tag_of.hpp</a>></span></div><div class="line"></div><div class="line"><span class="preprocessor">#include <algorithm></span></div><div class="line"><span class="preprocessor">#include <iterator></span></div><div class="line"><span class="preprocessor">#include <sstream></span></div><div class="line"><span class="preprocessor">#include <vector></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> <<span class="keyword">typename</span> T></div><div class="line"><span class="keyword">struct </span>print_impl : hana::default_ {</div><div class="line"> <span class="keyword">template</span> <<span class="keyword">typename</span> Stream, <span class="keyword">typename</span> X></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& out, X <span class="keyword">const</span>& x)</div><div class="line"> { out << 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>& stream, <span class="keyword">auto</span> <span class="keyword">const</span>& x) {</div><div class="line"> <span class="keywordflow">return</span> print_impl<<a class="code" href="group__group-core.html#ga686d1236161b5690ab302500077988e1">hana::tag_of_t</a><decltype(x)>><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> <<span class="keyword">typename</span> T></div><div class="line"><span class="keyword">struct </span>print_impl<std::vector<T>> {</div><div class="line"> <span class="keyword">template</span> <<span class="keyword">typename</span> Stream></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& out, std::vector<T> <span class="keyword">const</span>& xs) {</div><div class="line"> out << <span class="charliteral">'['</span>;</div><div class="line"> std::copy(begin(xs), end(xs), std::ostream_iterator<T>{out, <span class="stringliteral">", "</span>});</div><div class="line"> out << <span class="charliteral">']'</span>;</div><div class="line"> }</div><div class="line">};</div><div class="line"></div><div class="line">static_assert(hana::is_default<print_impl<int>>{}, <span class="stringliteral">""</span>);</div><div class="line">static_assert(!hana::is_default<print_impl<std::vector<int>>>{}, <span class="stringliteral">""</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<int>{1, 2, 3});</div><div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(s.str() == <span class="stringliteral">"[1, 2, 3, ]"</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">"abcd"</span>);</div><div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(s.str() == <span class="stringliteral">"abcd"</span>);</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --> </div>
- <p>Inherited by boost::hana::accessors_impl< S, when< condition > >, boost::hana::adjust_if_impl< Fun, when< condition > >, boost::hana::adjust_impl< Fun, when< condition > >, boost::hana::all_impl< S, when< condition > >, boost::hana::all_of_impl< S, when< condition > >, boost::hana::and_impl< L, when< condition > >, boost::hana::any_impl< S, when< condition > >, boost::hana::any_of_impl< S, when< condition > >, boost::hana::ap_impl< A, when< condition > >, boost::hana::append_impl< M, when< condition > >, boost::hana::at_impl< It, when< condition > >, boost::hana::at_key_impl< S, when< condition > >, boost::hana::back_impl< It, when< condition > >, boost::hana::cartesian_product_impl< S, when< condition > >, boost::hana::chain_impl< M, when< condition > >, boost::hana::concat_impl< M, when< condition > >, boost::hana::contains_impl< S, when< condition > >, boost::hana::count_if_impl< T, when< condition > >, boost::hana::count_impl< T, when< condition > >, boost::hana::cycle_impl< M, when< condition > >, boost::hana::difference_impl< S, when< condition > >, boost::hana::div_impl< T, U, when< condition > >, boost::hana::drop_back_impl< S, when< condition > >, boost::hana::drop_front_exactly_impl< It, when< condition > >, boost::hana::drop_front_impl< It, when< condition > >, boost::hana::drop_while_impl< It, when< condition > >, boost::hana::duplicate_impl< W, when< condition > >, boost::hana::empty_impl< M, when< condition > >, boost::hana::equal_impl< T, U, when< condition > >, boost::hana::erase_key_impl< T, when< condition > >, boost::hana::eval_if_impl< L, when< condition > >, boost::hana::eval_impl< T, when< condition > >, boost::hana::extend_impl< W, when< condition > >, boost::hana::extract_impl< W, when< condition > >, boost::hana::fill_impl< Fun, when< condition > >, boost::hana::filter_impl< M, when< condition > >, boost::hana::find_if_impl< S, when< condition > >, boost::hana::find_impl< S, when< condition > >, boost::hana::first_impl< P, when< condition > >, boost::hana::flatten_impl< M, when< condition > >, boost::hana::fold_left_impl< T, when< condition > >, boost::hana::fold_right_impl< T, when< condition > >, boost::hana::for_each_impl< T, when< condition > >, boost::hana::front_impl< It, when< condition > >, boost::hana::greater_equal_impl< T, U, when< condition > >, boost::hana::greater_impl< T, U, when< condition > >, boost::hana::group_impl< S, when< condition > >, boost::hana::hash_impl< Tag, when< condition > >, boost::hana::if_impl< L, when< condition > >, boost::hana::insert_impl< T, when< condition > >, boost::hana::intersection_impl< S, when< condition > >, boost::hana::intersperse_impl< S, when< condition > >, boost::hana::is_disjoint_impl< S1, S2, when< condition > >, boost::hana::is_empty_impl< It, when< condition > >, boost::hana::is_subset_impl< S1, S2, when< condition > >, boost::hana::keys_impl< T, when< condition > >, boost::hana::length_impl< T, when< condition > >, boost::hana::less_equal_impl< T, U, when< condition > >, boost::hana::less_impl< T, U, when< condition > >, boost::hana::lexicographical_compare_impl< It, when< condition > >, boost::hana::lift_impl< A, when< condition > >, boost::hana::make_impl< Datatype, when< condition > >, boost::hana::max_impl< T, U, when< condition > >, boost::hana::maximum_impl< T, when< condition > >, boost::hana::maximum_pred_impl< T, when< condition > >, boost::hana::members_impl< S, when< condition > >, boost::hana::min_impl< T, U, when< condition > >, boost::hana::minimum_impl< T, when< condition > >, boost::hana::minimum_pred_impl< T, when< condition > >, boost::hana::minus_impl< T, T, when< condition > >, boost::hana::minus_impl< T, U, when< condition > >, boost::hana::mod_impl< T, U, when< condition > >, boost::hana::monadic_fold_left_impl< T, when< condition > >, boost::hana::monadic_fold_right_impl< T, when< condition > >, boost::hana::mult_impl< T, U, when< condition > >, boost::hana::negate_impl< T, when< condition > >, boost::hana::none_impl< S, when< condition > >, boost::hana::none_of_impl< S, when< condition > >, boost::hana::not_equal_impl< T, U, when< condition > >, boost::hana::not_impl< L, when< condition > >, boost::hana::one_impl< R, when< condition > >, boost::hana::or_impl< L, when< condition > >, boost::hana::partition_impl< S, when< condition > >, boost::hana::permutations_impl< S, when< condition > >, boost::hana::plus_impl< T, U, when< condition > >, boost::hana::power_impl< R, when< condition > >, boost::hana::prefix_impl< M, when< condition > >, boost::hana::prepend_impl< M, when< condition > >, boost::hana::product_impl< T, when< condition > >, boost::hana::remove_at_impl< S, when< condition > >, boost::hana::remove_if_impl< M, when< condition > >, boost::hana::remove_impl< M, when< condition > >, boost::hana::remove_range_impl< S, when< condition > >, boost::hana::repeat_impl< I, when< condition > >, boost::hana::replace_if_impl< Fun, when< condition > >, boost::hana::replace_impl< Fun, when< condition > >, boost::hana::replicate_impl< M, when< condition > >, boost::hana::reverse_impl< S, when< condition > >, boost::hana::scan_left_impl< S, when< condition > >, boost::hana::scan_right_impl< S, when< condition > >, boost::hana::second_impl< P, when< condition > >, boost::hana::slice_impl< S, when< condition > >, boost::hana::sort_impl< S, when< condition > >, boost::hana::span_impl< S, when< condition > >, boost::hana::suffix_impl< M, when< condition > >, boost::hana::sum_impl< T, when< condition > >, boost::hana::symmetric_difference_impl< S, when< condition > >, boost::hana::take_back_impl< S, when< condition > >, boost::hana::take_front_impl< S, when< condition > >, boost::hana::take_while_impl< S, when< condition > >, boost::hana::tap_impl< M, when< condition > >, boost::hana::then_impl< M, when< condition > >, boost::hana::transform_impl< Fun, when< condition > >, boost::hana::unfold_left_impl< S, when< condition > >, boost::hana::unfold_right_impl< S, when< condition > >, boost::hana::union_impl< S, when< condition > >, boost::hana::unique_impl< S, when< condition > >, boost::hana::unpack_impl< T, when< condition > >, boost::hana::value_impl< C, when< condition > >, boost::hana::while_impl< L, hana::when< condition > >, boost::hana::zero_impl< M, when< condition > >, boost::hana::zip_impl< S, when< condition > >, boost::hana::zip_shortest_impl< S, when< condition > >, and boost::hana::zip_shortest_with_impl< S, when< condition > >.</p>
- </div><!-- contents -->
- </div><!-- doc-content -->
- <!--
- Copyright Louis Dionne 2013-2017
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
- -->
- <!-- boost-no-inspect -->
- <!-- HTML footer for doxygen 1.8.9.1-->
- <!-- start footer part -->
- <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
- <ul>
- <li class="navelem"><b>boost</b></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>
- </ul>
- </div>
- </body>
- </html>
|