Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
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
ngraph
Commits
b9af3723
Unverified
Commit
b9af3723
authored
Oct 30, 2019
by
Scott Cyphers
Committed by
GitHub
Oct 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow type info to be used as a key. (#3822)
parent
50329a59
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
type.hpp
src/ngraph/type.hpp
+10
-0
No files found.
src/ngraph/type.hpp
View file @
b9af3723
...
...
@@ -17,8 +17,11 @@
#pragma once
#include <memory>
#include <string>
#include <utility>
#include "ngraph/ngraph_visibility.hpp"
namespace
ngraph
{
/// Supports three functions, is_type<Type>, as_type<Type>, and as_type_ptr<Type> for type-safe
...
...
@@ -28,12 +31,19 @@ namespace ngraph
/// Type information for a type system without inheritance; instances have exactly one type not
/// related to any other type.
NGRAPH_API
struct
DiscreteTypeInfo
{
const
char
*
name
;
uint64_t
version
;
bool
is_castable
(
const
DiscreteTypeInfo
&
target_type
)
const
{
return
this
==
&
target_type
;
}
// For use as a key
bool
operator
<
(
const
DiscreteTypeInfo
&
b
)
const
{
return
version
<
b
.
version
||
(
version
==
b
.
version
&&
std
::
string
(
name
)
<
std
::
string
(
b
.
name
));
}
};
/// \brief Tests if value is a pointer/shared_ptr that can be statically cast to a
...
...
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