Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
fdb4df86
Commit
fdb4df86
authored
Apr 12, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimized index-based access
parent
b4648917
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
cppa/detail/tdata.hpp
cppa/detail/tdata.hpp
+21
-5
No files found.
cppa/detail/tdata.hpp
View file @
fdb4df86
...
@@ -132,6 +132,8 @@ template<>
...
@@ -132,6 +132,8 @@ template<>
struct
tdata
<>
struct
tdata
<>
{
{
typedef
tdata
super
;
util
::
void_type
head
;
util
::
void_type
head
;
typedef
util
::
void_type
head_type
;
typedef
util
::
void_type
head_type
;
...
@@ -312,22 +314,36 @@ struct tdata<Head, Tail...> : tdata<Tail...>
...
@@ -312,22 +314,36 @@ struct tdata<Head, Tail...> : tdata<Tail...>
inline
void
const
*
at
(
size_t
p
)
const
inline
void
const
*
at
(
size_t
p
)
const
{
{
return
(
p
==
0
)
?
ptr_to
(
head
)
:
super
::
at
(
p
-
1
);
CPPA_REQUIRE
(
p
<
num_elements
);
switch
(
p
)
{
case
0
:
return
ptr_to
(
head
);
case
1
:
return
ptr_to
(
super
::
head
);
case
2
:
return
ptr_to
(
super
::
super
::
head
);
case
3
:
return
ptr_to
(
super
::
super
::
super
::
head
);
case
4
:
return
ptr_to
(
super
::
super
::
super
::
super
::
head
);
case
5
:
return
ptr_to
(
super
::
super
::
super
::
super
::
super
::
head
);
default:
return
super
::
at
(
p
-
1
);
}
//return (p == 0) ? ptr_to(head) : super::at(p - 1);
}
}
inline
void
*
mutable_at
(
size_t
p
)
inline
void
*
mutable_at
(
size_t
p
)
{
{
# ifdef CPPA_DEBUG
if
(
p
==
0
)
if
(
p
==
0
)
{
{
# ifdef CPPA_DEBUG
if
(
std
::
is_same
<
decltype
(
ptr_to
(
head
)),
void
const
*>::
value
)
if
(
std
::
is_same
<
decltype
(
ptr_to
(
head
)),
void
const
*>::
value
)
{
{
throw
std
::
logic_error
{
"mutable_at with const head"
};
throw
std
::
logic_error
{
"mutable_at with const head"
};
}
}
# endif
return
const_cast
<
void
*>
(
ptr_to
(
head
));
return
const_cast
<
void
*>
(
ptr_to
(
head
));
}
}
return
super
::
mutable_at
(
p
-
1
);
return
super
::
mutable_at
(
p
-
1
);
# else
return
const_cast
<
void
*>
(
at
(
p
));
# endif
}
}
inline
uniform_type_info
const
*
type_at
(
size_t
p
)
const
inline
uniform_type_info
const
*
type_at
(
size_t
p
)
const
...
@@ -418,10 +434,10 @@ mk_tdata(Args&&... args)
...
@@ -418,10 +434,10 @@ mk_tdata(Args&&... args)
}
}
template
<
size_t
N
,
typename
...
Tn
>
template
<
size_t
N
,
typename
...
Tn
>
const
typename
util
::
at
<
N
,
Tn
...
>::
type
&
get
(
detail
::
tdata
<
Tn
...
>
const
&
tv
)
typename
util
::
at
<
N
,
Tn
...
>::
type
const
&
get
(
detail
::
tdata
<
Tn
...
>
const
&
tv
)
{
{
static_assert
(
N
<
sizeof
...(
Tn
),
"N >= tv.size()"
);
static_assert
(
N
<
sizeof
...(
Tn
),
"N >= tv.size()"
);
return
static_cast
<
const
typename
detail
::
tdata_upcast_helper
<
N
,
Tn
...
>::
type
&>
(
tv
).
head
;
return
static_cast
<
typename
detail
::
tdata_upcast_helper
<
N
,
Tn
...
>::
type
const
&>
(
tv
).
head
;
}
}
template
<
size_t
N
,
typename
...
Tn
>
template
<
size_t
N
,
typename
...
Tn
>
...
...
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