2018-01-12 21:47:58 +01:00
<!--
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" / >
2021-10-05 21:37:46 +02:00
< meta name = "generator" content = "Doxygen 1.8.20" / >
2018-01-12 21:47:58 +01:00
< title > Boost.Hana: boost::hana::when< condition > Struct Template 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 >
< 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" >
2021-10-05 21:37:46 +02:00
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
2018-01-12 21:47:58 +01:00
$(document).ready(function() { init_search(); });
2021-10-05 21:37:46 +02:00
/* @license-end */
2018-01-12 21:47:58 +01:00
< / 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"
}
}
});
2021-10-05 21:37:46 +02:00
< / script >
< script type = "text/javascript" async = "async" src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js" > < / script >
2018-01-12 21:47:58 +01:00
< 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
2021-10-05 21:37:46 +02:00
  < span id = "projectnumber" > 1.7.0< / span >
2018-01-12 21:47:58 +01:00
< / div >
< div id = "projectbrief" > Your standard library for metaprogramming< / div >
< / td >
< td > < div id = "MSearchBox" class = "MSearchBoxInactive" >
< span class = "left" >
2021-10-05 21:37:46 +02:00
< img id = "MSearchSelect" src = "search/mag_sel.svg"
2018-01-12 21:47:58 +01:00
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" >
2021-10-05 21:37:46 +02:00
< a id = "MSearchClose" href = "javascript:searchBox.CloseResultsWindow()" > < img id = "MSearchCloseImg" border = "0" src = "search/close.svg" alt = "" / > < / a >
2018-01-12 21:47:58 +01:00
< / span >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2021-10-05 21:37:46 +02:00
<!-- Generated by Doxygen 1.8.20 -->
2018-01-12 21:47:58 +01:00
< script type = "text/javascript" >
2021-10-05 21:37:46 +02:00
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
2018-01-12 21:47:58 +01:00
var searchBox = new SearchBox("searchBox", "search",false,'Search');
2021-10-05 21:37:46 +02:00
/* @license-end */
2018-01-12 21:47:58 +01:00
< / 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" >
2021-10-05 21:37:46 +02:00
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('structboost_1_1hana_1_1when.html',''); initResizable(); });
/* @license-end */
2018-01-12 21:47:58 +01:00
< / 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::when< condition > Struct Template 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" > < h3 > template< bool condition> < br / >
struct boost::hana::when< condition > < / h3 >
< p > Enable a partial specialization only if a boolean condition is true. < / p >
< p > You might also want to take a look at < code > when_valid< / code > , which provides similar functionality but enables a specialziation only when some expression is well-formed.< / p >
< blockquote class = "doxtable" >
2021-10-05 21:37:46 +02:00
< p > < / p >
2018-01-12 21:47:58 +01:00
< / blockquote >
2021-10-05 21:37:46 +02:00
< h4 > < a class = "anchor" id = "autotoc_md202" > < / a >
Rationale for using < tt> when< /tt> instead of < tt> std::enable_if< /tt> < / h4 >
< p > < code > when< / code > is used to control the priority of partial specializations in a finer grained manner than what can be achieved with the usual < code > typename Enable = void< / code > and < code > std::enable_if< / code > pattern. For example, a partially specialized tag-dispatched method will have a higher priority than an equivalent specialization that uses < code > when< / code > . For more details, see the tutorial section on < a class = "el" href = "index.html#tutorial-core-tag_dispatching" > tag-dispatching< / a > . < / p >
< h2 > < a class = "anchor" id = "autotoc_md203" > < / a >
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 = "core_2when_8hpp.html" > boost/hana/core/when.hpp< / a > > < / span > < / div >
< div class = "line" > < / div >
< div class = "line" > < span class = "preprocessor" > #include < type_traits> < / 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 = "keyword" > template< / span > < < span class = "keyword" > typename< / span > T, < span class = "keyword" > typename< / span > = hana::when< true> > < / div >
< div class = "line" > < span class = "keyword" > struct < / span > base_template;< / div >
< div class = "line" > < / div >
< div class = "line" > < span class = "keyword" > template< / span > < < span class = "keyword" > typename< / span > T> < / div >
< div class = "line" > < span class = "keyword" > struct < / span > base_template< T, hana::when< std::is_integral< T> ::value> > {< / div >
< div class = "line" > < span class = "comment" > // something useful...< / span > < / div >
< div class = "line" > };< / div >
< div class = "line" > < / div >
< div class = "line" > < span class = "keywordtype" > int< / span > main() { }< / div >
< / div > <!-- fragment --> < / div > < / div > <!-- contents -->
2018-01-12 21:47:58 +01:00
< / div > <!-- doc - content -->
2021-10-05 21:37:46 +02:00
< div class = "ttc" id = "acore_2when_8hpp_html" > < div class = "ttname" > < a href = "core_2when_8hpp.html" > when.hpp< / a > < / div > < div class = "ttdoc" > Defines boost::hana::when and boost::hana::when_valid.< / div > < / div >
< div class = "ttc" id = "anamespaceboost_1_1hana_html" > < div class = "ttname" > < a href = "namespaceboost_1_1hana.html" > boost::hana< / a > < / div > < div class = "ttdoc" > Namespace containing everything in the library.< / div > < div class = "ttdef" > < b > Definition:< / b > accessors.hpp:20< / div > < / div >
2018-01-12 21:47:58 +01:00
<!--
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_1when.html" > when< / a > < / li >
< / ul >
< / div >
< / body >
< / html >