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
676601f6
Commit
676601f6
authored
Mar 04, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atoms... not
parent
0f3b4dea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
27 deletions
+15
-27
src/test__atom.cpp
src/test__atom.cpp
+15
-27
No files found.
src/test__atom.cpp
View file @
676601f6
...
...
@@ -67,12 +67,12 @@ unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed )
unsigned
int
hash_of
(
const
char
*
what
,
int
what_length
)
{
return
MurmurHash2
(
what
,
what_length
,
0x
DEADC0DE
);
return
MurmurHash2
(
what
,
what_length
,
0x
15091984
);
}
unsigned
int
hash_of
(
const
std
::
string
&
what
)
{
return
MurmurHash2
(
what
.
c_str
(),
what
.
size
(),
0x
DEADC0DE
);
return
MurmurHash2
(
what
.
c_str
(),
what
.
size
(),
0x
15091984
);
}
template
<
char
...
Str
>
...
...
@@ -107,6 +107,10 @@ class atom_base
{
}
atom_base
(
atom_base
&&
rval
)
:
m_str
(
std
::
move
(
rval
.
m_str
)),
m_hash
(
hash_of
(
m_str
))
{
}
unsigned
int
hash
()
const
{
return
m_hash
;
...
...
@@ -119,45 +123,25 @@ class atom_base
};
/*
template<char... Str>
class atom : atom_base
{
static std::string to_string()
{
std::string result;
_tostring<Str...>::_(result);
return result;
}
public:
atom() : atom_base(to_string()) { }
};
*/
/*
bool operator==(const atom& lhs, const atom& rhs)
bool
operator
==
(
const
atom_base
&
lhs
,
const
atom_base
&
rhs
)
{
return
(
lhs
.
hash
()
==
rhs
.
hash
())
&&
(
lhs
.
value
()
==
rhs
.
value
());
}
bool operator!=(const atom
& lhs, const atom
& rhs)
bool
operator
!=
(
const
atom
_base
&
lhs
,
const
atom_base
&
rhs
)
{
return
!
(
lhs
==
rhs
);
}
bool operator!=(const atom& lhs, const std::string& rhs)
bool
operator
!=
(
const
atom
_base
&
lhs
,
const
std
::
string
&
rhs
)
{
return
lhs
.
value
()
==
rhs
;
}
bool operator!=(const std::string& lhs, const atom& rhs)
bool
operator
!=
(
const
std
::
string
&
lhs
,
const
atom
_base
&
rhs
)
{
return
lhs
==
rhs
.
value
();
}
*/
// template<char...>
// atom<Str...> operator "" _atom();
...
...
@@ -175,6 +159,7 @@ class atom : public atom_base
public:
atom
()
:
atom_base
(
to_string
())
{
}
atom
(
atom
&&
rval
)
:
atom_base
(
rval
)
{
}
};
...
...
@@ -184,8 +169,11 @@ void test__atom()
CPPA_TEST
(
test__atom
);
atom
<
'f'
,
'o'
,
'o'
>
a1
;
atom_base
a2
(
"foo"
);
atom_base
a3
=
atom
<
'a'
,
'b'
,
'c'
>
();
cout
<<
"a1 = "
<<
a1
.
value
()
<<
endl
;
CPPA_CHECK
(
a1
==
a2
);
CPPA_CHECK
(
a1
!=
a3
);
// atom<"foobar"> a1;
...
...
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