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
03ab7799
Commit
03ab7799
authored
Aug 24, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix (fixed operator== for integer types)
parent
c5e53ab2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
11 deletions
+49
-11
src/uniform_type_info.cpp
src/uniform_type_info.cpp
+49
-11
No files found.
src/uniform_type_info.cpp
View file @
03ab7799
...
...
@@ -6,6 +6,7 @@
#include <string>
#include <atomic>
#include <limits>
#include <cstring>
#include <cstdint>
#include <sstream>
#include <iostream>
...
...
@@ -513,6 +514,30 @@ class atom_value_tinfo : public util::abstract_uniform_type_info<atom_value>
};
const
std
::
map
<
int
,
std
::
pair
<
string_set
,
string_set
>>&
int_names
();
template
<
typename
T
>
class
int_tinfo
:
public
detail
::
default_uniform_type_info_impl
<
T
>
{
public:
bool
equal
(
const
std
::
type_info
&
tinfo
)
const
{
// TODO: string comparsion sucks & is slow; find a nicer solution
auto
map_iter
=
int_names
().
find
(
sizeof
(
T
));
const
string_set
&
st
=
is_signed
<
T
>::
value
?
map_iter
->
second
.
first
:
map_iter
->
second
.
second
;
auto
end
=
st
.
end
();
for
(
auto
i
=
st
.
begin
();
i
!=
end
;
++
i
)
{
if
((
*
i
)
==
raw_name
(
tinfo
))
return
true
;
}
return
false
;
}
};
class
uniform_type_info_map
{
...
...
@@ -524,6 +549,8 @@ class uniform_type_info_map
// maps uniform names to uniform type informations
uti_map
m_by_uname
;
std
::
map
<
int
,
std
::
pair
<
string_set
,
string_set
>>
m_ints
;
void
insert
(
uniform_type_info
*
uti
,
const
std
::
set
<
std
::
string
>&
tnames
)
{
if
(
tnames
.
empty
())
...
...
@@ -540,7 +567,8 @@ class uniform_type_info_map
template
<
typename
T
>
inline
void
insert
(
const
std
::
set
<
std
::
string
>&
tnames
)
{
insert
(
new
default_uniform_type_info_impl
<
T
>
(),
tnames
);
//insert(new default_uniform_type_info_impl<T>(), tnames);
insert
(
new
int_tinfo
<
T
>
,
tnames
);
}
template
<
typename
T
>
...
...
@@ -578,7 +606,6 @@ class uniform_type_info_map
insert
<
any_type
>
();
// first: signed
// second: unsigned
std
::
map
<
int
,
std
::
pair
<
string_set
,
string_set
>>
ints
;
push
<
char
,
signed
char
,
unsigned
char
,
...
...
@@ -602,15 +629,15 @@ class uniform_type_info_map
unsigned
long
long
,
wchar_t
,
char16_t
,
char32_t
>
(
ints
);
insert
<
std
::
int8_t
>
(
ints
[
sizeof
(
std
::
int8_t
)].
first
);
insert
<
std
::
uint8_t
>
(
ints
[
sizeof
(
std
::
uint8_t
)].
second
);
insert
<
std
::
int16_t
>
(
ints
[
sizeof
(
std
::
int16_t
)].
first
);
insert
<
std
::
uint16_t
>
(
ints
[
sizeof
(
std
::
uint16_t
)].
second
);
insert
<
std
::
int32_t
>
(
ints
[
sizeof
(
std
::
int32_t
)].
first
);
insert
<
std
::
uint32_t
>
(
ints
[
sizeof
(
std
::
uint32_t
)].
second
);
insert
<
std
::
int64_t
>
(
ints
[
sizeof
(
std
::
int64_t
)].
first
);
insert
<
std
::
uint64_t
>
(
ints
[
sizeof
(
std
::
uint64_t
)].
second
);
char32_t
>
(
m_
ints
);
insert
<
std
::
int8_t
>
(
m_
ints
[
sizeof
(
std
::
int8_t
)].
first
);
insert
<
std
::
uint8_t
>
(
m_
ints
[
sizeof
(
std
::
uint8_t
)].
second
);
insert
<
std
::
int16_t
>
(
m_
ints
[
sizeof
(
std
::
int16_t
)].
first
);
insert
<
std
::
uint16_t
>
(
m_
ints
[
sizeof
(
std
::
uint16_t
)].
second
);
insert
<
std
::
int32_t
>
(
m_
ints
[
sizeof
(
std
::
int32_t
)].
first
);
insert
<
std
::
uint32_t
>
(
m_
ints
[
sizeof
(
std
::
uint32_t
)].
second
);
insert
<
std
::
int64_t
>
(
m_
ints
[
sizeof
(
std
::
int64_t
)].
first
);
insert
<
std
::
uint64_t
>
(
m_
ints
[
sizeof
(
std
::
uint64_t
)].
second
);
}
~
uniform_type_info_map
()
...
...
@@ -624,6 +651,12 @@ class uniform_type_info_map
m_by_uname
.
clear
();
}
const
std
::
map
<
int
,
std
::
pair
<
string_set
,
string_set
>>&
int_names
()
const
{
return
m_ints
;
}
uniform_type_info
*
by_raw_name
(
const
std
::
string
&
name
)
{
auto
i
=
m_by_rname
.
find
(
name
);
...
...
@@ -684,6 +717,11 @@ uniform_type_info_map& s_uniform_type_info_map()
return
s_utimap
;
}
const
std
::
map
<
int
,
std
::
pair
<
string_set
,
string_set
>>&
int_names
()
{
return
s_uniform_type_info_map
().
int_names
();
}
}
}
}
// namespace cppa::detail::<anonymous>
namespace
{
...
...
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