Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
07d9b993
Commit
07d9b993
authored
9 years ago
by
Roman Tsisyk
Browse files
Options
Downloads
Patches
Plain Diff
Fix compilation on gcc-4.6
parent
06a0fb85
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/reflection.h
+15
-11
15 additions, 11 deletions
src/reflection.h
with
15 additions
and
11 deletions
src/reflection.h
+
15
−
11
View file @
07d9b993
...
...
@@ -167,9 +167,12 @@ template<> inline enum ctype ctypeof<const char *>() { return CTYPE_CONST_CHAR_P
* \cond false
*/
template
<
int
N
,
typename
...
Args
>
struct
method_helper
;
/** A helper for recursive templates */
template
<
int
N
,
typename
A
,
typename
...
Args
>
struct
method_helper
{
struct
method_helper
<
N
,
A
,
Args
...
>
{
static
bool
invokable
(
const
method
*
method
)
{
...
...
@@ -186,22 +189,17 @@ struct method_helper {
}
};
template
<
int
N
,
typename
R
>
struct
method_helper
<
N
,
R
>
{
template
<
int
N
>
struct
method_helper
<
N
>
{
static
bool
invokable
(
const
method
*
method
)
invokable
(
const
method
*
)
{
if
(
method
->
nargs
!=
N
)
return
false
;
if
(
method
->
rtype
!=
ctypeof
<
R
>
())
return
false
;
return
true
;
}
static
void
init
(
struct
method
*
method
)
{
method
->
rtype
=
ctypeof
<
R
>
();
method
->
nargs
=
N
;
}
};
...
...
@@ -222,7 +220,8 @@ make_method(const struct type *owner, const char *name,
m
.
name
=
name
;
m
.
thiscall
=
(
method_thiscall_f
)
method_arg
;
m
.
isconst
=
false
;
method_helper
<
0
,
Args
...,
R
>::
init
(
&
m
);
m
.
rtype
=
ctypeof
<
R
>
();
method_helper
<
0
,
Args
...
>::
init
(
&
m
);
return
m
;
}
...
...
@@ -241,9 +240,14 @@ make_method(const struct type *owner, const char *name,
template
<
typename
R
,
typename
...
Args
,
typename
T
>
inline
bool
method_invokable
(
const
struct
method
*
method
,
T
*
object
)
{
static_assert
(
sizeof
...(
Args
)
<=
METHOD_ARG_MAX
,
"too many arguments"
);
if
(
!
type_assignable
(
method
->
owner
,
object
->
type
))
return
false
;
return
method_helper
<
0
,
Args
...,
R
>::
invokable
(
method
);
if
(
method
->
rtype
!=
ctypeof
<
R
>
())
return
false
;
if
(
method
->
nargs
!=
sizeof
...(
Args
))
return
false
;
return
method_helper
<
0
,
Args
...
>::
invokable
(
method
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment