Skip to content

Commit

Permalink
Update gh-pages to output generated at cc919dc
Browse files Browse the repository at this point in the history
  • Loading branch information
braxtons12 committed Feb 1, 2024
1 parent 59e47f7 commit 4944006
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 3 deletions.
36 changes: 35 additions & 1 deletion _sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,41 @@ For an overview of each module, see the links in the left sidebar or below.
:caption: Example
:linenos:
#include <hyperion/mpl/list.h>
#include <hyperion/mpl/value.h>
#include <hyperion/mpl/type.h>
#include <concepts>
using namespace hyperion::mpl;
constexpr auto val1 = Value<4>{};
constexpr auto val2 = Value<2>{};
constexpr auto meaning_of_life = (val1 * 10_value) + val2;
static_assert(meaning_of_life == 42);
constexpr auto val3 = 10;
static_assert(std::same_as<typename decltype(decltype_(val3)
.apply<std::remove_reference>()
.apply<std::remove_const>()
.apply<std::add_rvalue_reference>())::type,
int&&>);
template<ValueType TValue>
struct add_one {
static inline constexpr auto value = TValue::value + 1;
};
template<ValueType TValue>
struct times_two {
static inline constexpr auto value = TValue::value * 2;
};
static_assert(decltype_(2_value)
.apply<add_one>()
.apply<times_two>()
.apply<add_one>() == 7);
.. toctree::
Expand Down
36 changes: 35 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,41 @@ <h1>hyperion::mpl<a class="headerlink" href="#hyperion-mpl" title="Link to this
<p>For an overview of each module, see the links in the left sidebar or below.</p>
<div class="literal-block-wrapper docutils container" id="id1">
<div class="code-block-caption"><span class="caption-text">Example</span><a class="headerlink" href="#id1" title="Link to this code">#</a></div>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="linenos">1</span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;hyperion/mpl/list.h&gt;</span>
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="linenos"> 1</span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;hyperion/mpl/value.h&gt;</span>
<span class="linenos"> 2</span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;hyperion/mpl/type.h&gt;</span>
<span class="linenos"> 3</span>
<span class="linenos"> 4</span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;concepts&gt;</span>
<span class="linenos"> 5</span>
<span class="linenos"> 6</span><span class="k">using</span><span class="w"> </span><span class="k">namespace</span><span class="w"> </span><span class="nn">hyperion</span><span class="o">::</span><span class="nn">mpl</span><span class="p">;</span>
<span class="linenos"> 7</span>
<span class="linenos"> 8</span><span class="k">constexpr</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">val1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Value</span><span class="o">&lt;</span><span class="mi">4</span><span class="o">&gt;</span><span class="p">{};</span>
<span class="linenos"> 9</span><span class="k">constexpr</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">val2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Value</span><span class="o">&lt;</span><span class="mi">2</span><span class="o">&gt;</span><span class="p">{};</span>
<span class="linenos">10</span>
<span class="linenos">11</span><span class="k">constexpr</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">meaning_of_life</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">val1</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">10</span><span class="n">_value</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">val2</span><span class="p">;</span>
<span class="linenos">12</span>
<span class="linenos">13</span><span class="k">static_assert</span><span class="p">(</span><span class="n">meaning_of_life</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">42</span><span class="p">);</span>
<span class="linenos">14</span>
<span class="linenos">15</span><span class="k">constexpr</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">val3</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">10</span><span class="p">;</span>
<span class="linenos">16</span><span class="k">static_assert</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">same_as</span><span class="o">&lt;</span><span class="k">typename</span><span class="w"> </span><span class="nc">decltype</span><span class="p">(</span><span class="n">decltype_</span><span class="p">(</span><span class="n">val3</span><span class="p">)</span>
<span class="linenos">17</span><span class="w"> </span><span class="p">.</span><span class="n">apply</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">remove_reference</span><span class="o">&gt;</span><span class="p">()</span>
<span class="linenos">18</span><span class="w"> </span><span class="p">.</span><span class="n">apply</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">remove_const</span><span class="o">&gt;</span><span class="p">()</span>
<span class="linenos">19</span><span class="w"> </span><span class="p">.</span><span class="n">apply</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">add_rvalue_reference</span><span class="o">&gt;</span><span class="p">())</span><span class="o">::</span><span class="n">type</span><span class="p">,</span>
<span class="linenos">20</span><span class="w"> </span><span class="kt">int</span><span class="o">&amp;&amp;&gt;</span><span class="p">);</span>
<span class="linenos">21</span>
<span class="linenos">22</span><span class="k">template</span><span class="o">&lt;</span><span class="n">ValueType</span><span class="w"> </span><span class="n">TValue</span><span class="o">&gt;</span>
<span class="linenos">23</span><span class="k">struct</span><span class="w"> </span><span class="nc">add_one</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">24</span><span class="w"> </span><span class="k">static</span><span class="w"> </span><span class="kr">inline</span><span class="w"> </span><span class="k">constexpr</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">TValue</span><span class="o">::</span><span class="n">value</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
<span class="linenos">25</span><span class="p">};</span>
<span class="linenos">26</span>
<span class="linenos">27</span><span class="k">template</span><span class="o">&lt;</span><span class="n">ValueType</span><span class="w"> </span><span class="n">TValue</span><span class="o">&gt;</span>
<span class="linenos">28</span><span class="k">struct</span><span class="w"> </span><span class="nc">times_two</span><span class="w"> </span><span class="p">{</span>
<span class="linenos">29</span><span class="w"> </span><span class="k">static</span><span class="w"> </span><span class="kr">inline</span><span class="w"> </span><span class="k">constexpr</span><span class="w"> </span><span class="k">auto</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">TValue</span><span class="o">::</span><span class="n">value</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">2</span><span class="p">;</span>
<span class="linenos">30</span><span class="p">};</span>
<span class="linenos">31</span>
<span class="linenos">32</span><span class="k">static_assert</span><span class="p">(</span><span class="n">decltype_</span><span class="p">(</span><span class="mi">2</span><span class="n">_value</span><span class="p">)</span>
<span class="linenos">33</span><span class="w"> </span><span class="p">.</span><span class="n">apply</span><span class="o">&lt;</span><span class="n">add_one</span><span class="o">&gt;</span><span class="p">()</span>
<span class="linenos">34</span><span class="w"> </span><span class="p">.</span><span class="n">apply</span><span class="o">&lt;</span><span class="n">times_two</span><span class="o">&gt;</span><span class="p">()</span>
<span class="linenos">35</span><span class="w"> </span><span class="p">.</span><span class="n">apply</span><span class="o">&lt;</span><span class="n">add_one</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">7</span><span class="p">);</span>
</pre></div>
</div>
</div>
Expand Down
Loading

0 comments on commit 4944006

Please sign in to comment.