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
8d6ca6e0
Commit
8d6ca6e0
authored
Nov 24, 2014
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build on non-MSVC compilers.
parent
ebce4aa6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
layout.h
c++/src/capnp/layout.h
+2
-2
test-util.h
c++/src/capnp/test-util.h
+4
-4
common.h
c++/src/kj/common.h
+11
-3
No files found.
c++/src/capnp/layout.h
View file @
8d6ca6e0
...
...
@@ -567,7 +567,7 @@ public:
:
segment
(
nullptr
),
ptr
(
nullptr
),
elementCount
(
0
*
ELEMENTS
),
step
(
0
*
BITS
/
ELEMENTS
)
{}
MSVC_DEFAULT_ASSIGNMENT_WORKAROUND
(,
ListBuilder
)
;
MSVC_DEFAULT_ASSIGNMENT_WORKAROUND
(,
ListBuilder
)
inline
word
*
getLocation
()
{
// Get the object's location.
...
...
@@ -645,7 +645,7 @@ public:
:
segment
(
nullptr
),
ptr
(
nullptr
),
elementCount
(
0
),
step
(
0
*
BITS
/
ELEMENTS
),
structDataSize
(
0
),
structPointerCount
(
0
),
nestingLimit
(
0x7fffffff
)
{}
MSVC_DEFAULT_ASSIGNMENT_WORKAROUND
(
const
,
ListReader
)
;
MSVC_DEFAULT_ASSIGNMENT_WORKAROUND
(
const
,
ListReader
)
inline
ElementCount
size
()
const
;
// The number of elements in the list.
...
...
c++/src/capnp/test-util.h
View file @
8d6ca6e0
...
...
@@ -127,7 +127,7 @@ inline void checkElement<double>(double a, double b) {
EXPECT_DOUBLE_EQ
(
a
,
b
);
}
template
<
typename
T
,
typename
L
=
T
::
Reads
>
template
<
typename
T
,
typename
L
=
typename
T
::
Reads
>
void
checkList
(
T
reader
,
std
::
initializer_list
<
decltype
(
reader
[
0
])
>
expected
)
{
ASSERT_EQ
(
expected
.
size
(),
reader
.
size
());
for
(
uint
i
=
0
;
i
<
expected
.
size
();
i
++
)
{
...
...
@@ -135,11 +135,11 @@ void checkList(T reader, std::initializer_list<decltype(reader[0])> expected) {
}
}
template
<
typename
T
,
typename
L
=
T
::
Builds
,
bool
=
false
>
void
checkList
(
T
reader
,
std
::
initializer_list
<
decltype
(
L
::
Reader
()[
0
])
>
expected
)
{
template
<
typename
T
,
typename
L
=
typename
T
::
Builds
,
bool
=
false
>
void
checkList
(
T
reader
,
std
::
initializer_list
<
decltype
(
typename
L
::
Reader
()[
0
])
>
expected
)
{
ASSERT_EQ
(
expected
.
size
(),
reader
.
size
());
for
(
uint
i
=
0
;
i
<
expected
.
size
();
i
++
)
{
checkElement
<
decltype
(
L
::
Reader
()[
0
])
>
(
expected
.
begin
()[
i
],
reader
[
i
]);
checkElement
<
decltype
(
typename
L
::
Reader
()[
0
])
>
(
expected
.
begin
()[
i
],
reader
[
i
]);
}
}
...
...
c++/src/kj/common.h
View file @
8d6ca6e0
...
...
@@ -471,12 +471,20 @@ using MinType = typename MinType_<T, U, sizeof(T) <= sizeof(U)>::Type;
template
<
typename
T
,
typename
U
>
inline
KJ_CONSTEXPR
()
auto
min
(
T
&&
a
,
U
&&
b
)
->
MinType
<
Decay
<
T
>
,
Decay
<
U
>>
{
return
MinType
<
Decay
<
T
>
,
Decay
<
U
>>
(
a
<
b
?
a
:
b
);
return
a
<
b
?
MinType
<
Decay
<
T
>
,
Decay
<
U
>>
(
a
)
:
MinType
<
Decay
<
T
>
,
Decay
<
U
>>
(
b
);
}
template
<
typename
T
,
typename
U
,
bool
takeT
>
struct
MaxType_
;
template
<
typename
T
,
typename
U
>
struct
MaxType_
<
T
,
U
,
true
>
{
typedef
T
Type
;
};
template
<
typename
T
,
typename
U
>
struct
MaxType_
<
T
,
U
,
false
>
{
typedef
U
Type
;
};
template
<
typename
T
,
typename
U
>
using
MaxType
=
typename
MaxType_
<
T
,
U
,
sizeof
(
T
)
>=
sizeof
(
U
)
>::
Type
;
// Resolves to the larger of the two input types.
template
<
typename
T
,
typename
U
>
inline
KJ_CONSTEXPR
()
auto
max
(
T
&&
a
,
U
&&
b
)
->
Decay
<
decltype
(
a
>
b
?
a
:
b
)
>
{
return
a
>
b
?
a
:
b
;
inline
KJ_CONSTEXPR
()
auto
max
(
T
&&
a
,
U
&&
b
)
->
MaxType
<
Decay
<
T
>
,
Decay
<
U
>
>
{
return
a
>
b
?
MaxType
<
Decay
<
T
>
,
Decay
<
U
>>
(
a
)
:
MaxType
<
Decay
<
T
>
,
Decay
<
U
>>
(
b
)
;
}
template
<
typename
T
,
size_t
s
>
...
...
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