Skip to content

Commit 7adc91b

Browse files
add integral_constant.hpp.
1 parent 534b46c commit 7adc91b

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

integral_constant.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
namespace mlib
4+
{
5+
template <typename T, T I> struct integral_constant {
6+
static constexpr T value = I;
7+
using value_type = T;
8+
9+
constexpr operator value_type() const noexcept { return value; }
10+
11+
constexpr auto operator()() const noexcept { return value; }
12+
};
13+
} // namespace mlib

mlib.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
<ClInclude Include="get_nth_element.hpp" />
146146
<ClInclude Include="index_sequence.hpp" />
147147
<ClInclude Include="inlin_if.hpp" />
148+
<ClInclude Include="integral_constant.hpp" />
148149
<ClInclude Include="loop.hpp" />
149150
<ClInclude Include="meta_struct.hpp" />
150151
<ClInclude Include="mlib.hpp" />

mlib.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
<ClInclude Include="pack.hpp">
103103
<Filter>Header Files</Filter>
104104
</ClInclude>
105+
<ClInclude Include="integral_constant.hpp">
106+
<Filter>Header Files</Filter>
107+
</ClInclude>
105108
</ItemGroup>
106109
<ItemGroup>
107110
<ClCompile Include="Main.cpp">

0 commit comments

Comments
 (0)