Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
25ce8b86
Commit
25ce8b86
authored
Mar 10, 2016
by
Harris Hancock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MSVC exclusions in units.h
parent
19096841
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
units.h
c++/src/kj/units.h
+5
-12
No files found.
c++/src/kj/units.h
View file @
25ce8b86
...
...
@@ -67,10 +67,6 @@ struct Id {
// =======================================================================================
// Quantity and UnitRatio -- implement unit analysis via the type system
#if !_MSC_VER
// TODO(msvc): MSVC has trouble with this intense templating. Luckily Cap'n Proto can deal with
// using regular integers in place of Quantity, so we can just skip all this.
template
<
typename
T
>
constexpr
bool
isIntegral
()
{
return
false
;
}
template
<>
constexpr
bool
isIntegral
<
char
>
()
{
return
true
;
}
template
<>
constexpr
bool
isIntegral
<
signed
char
>
()
{
return
true
;
}
...
...
@@ -225,9 +221,12 @@ class Quantity {
public
:
inline
constexpr
Quantity
()
{}
inline
constexpr
Quantity
(
decltype
(
maxValue
)
)
:
value
(
maxValue
)
{}
inline
constexpr
Quantity
(
decltype
(
minValue
)
)
:
value
(
minValue
)
{}
inline
constexpr
Quantity
(
MaxValue_
)
:
value
(
maxValue
)
{}
inline
constexpr
Quantity
(
MinValue_
)
:
value
(
minValue
)
{}
// Allow initialization from maxValue and minValue.
// TODO(msvc): decltype(maxValue) and decltype(minValue) deduce unknown-type for these function
// parameters, causing the compiler to complain of a duplicate constructor definition, so we
// specify MaxValue_ and MinValue_ types explicitly.
inline
explicit
constexpr
Quantity
(
Number
value
)
:
value
(
value
)
{}
// This constructor was intended to be private, but GCC complains about it being private in a
...
...
@@ -354,15 +353,11 @@ private:
friend
inline
constexpr
T
unit
();
};
#endif // !_MSC_VER
template
<
typename
T
>
inline
constexpr
T
unit
()
{
return
T
(
1
);
}
// unit<Quantity<T, U>>() returns a Quantity of value 1. It also, intentionally, works on basic
// numeric types.
#if !_MSC_VER
template
<
typename
Number1
,
typename
Number2
,
typename
Unit
>
inline
constexpr
auto
operator
*
(
Number1
a
,
Quantity
<
Number2
,
Unit
>
b
)
->
Quantity
<
decltype
(
Number1
(
1
)
*
Number2
(
1
)),
Unit
>
{
...
...
@@ -433,8 +428,6 @@ inline constexpr T origin() { return T(0 * unit<UnitOf<T>>()); }
// origin<Absolute<T, U>>() returns an Absolute of value 0. It also, intentionally, works on basic
// numeric types.
#endif // !_MSC_VER
}
// namespace kj
#endif // KJ_UNITS_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment