Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
19fd3bb6
There was an error fetching the commit references. Please try again later.
Commit
19fd3bb6
authored
6 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Smart pointers should be initializable by nullptr
parent
6fab1ab1
No related branches found
No related tags found
1 merge request
!5
Decoupling linear solvers from PDE solvers
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/TNL/SharedPointer.h
+15
-0
15 additions, 0 deletions
src/TNL/SharedPointer.h
src/TNL/UniquePointer.h
+20
-5
20 additions, 5 deletions
src/TNL/UniquePointer.h
with
35 additions
and
5 deletions
src/TNL/SharedPointer.h
+
15
−
0
View file @
19fd3bb6
...
...
@@ -18,6 +18,7 @@
#include
<TNL/SmartPointer.h>
#include
<cstring>
#include
<cstddef>
// std::nullptr_t
...
...
@@ -76,6 +77,10 @@ class SharedPointer< Object, Devices::Host > : public SmartPointer
typedef
Devices
::
Host
DeviceType
;
typedef
SharedPointer
<
Object
,
Devices
::
Host
>
ThisType
;
SharedPointer
(
std
::
nullptr_t
)
:
pd
(
nullptr
)
{}
template
<
typename
...
Args
>
explicit
SharedPointer
(
Args
...
args
)
:
pd
(
nullptr
)
...
...
@@ -312,6 +317,11 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer
typedef
Devices
::
Cuda
DeviceType
;
typedef
SharedPointer
<
Object
,
Devices
::
Cuda
>
ThisType
;
SharedPointer
(
std
::
nullptr_t
)
:
pd
(
nullptr
),
cuda_pointer
(
nullptr
)
{}
template
<
typename
...
Args
>
explicit
SharedPointer
(
Args
...
args
)
:
pd
(
nullptr
),
...
...
@@ -651,6 +661,11 @@ class SharedPointer< Object, Devices::MIC > : public SmartPointer
typedef
Devices
::
MIC
DeviceType
;
typedef
SharedPointer
<
Object
,
Devices
::
MIC
>
ThisType
;
SharedPointer
(
std
::
nullptr_t
)
:
pd
(
nullptr
),
mic_pointer
(
nullptr
)
{}
template
<
typename
...
Args
>
explicit
SharedPointer
(
Args
...
args
)
:
pd
(
nullptr
),
...
...
This diff is collapsed.
Click to expand it.
src/TNL/UniquePointer.h
+
20
−
5
View file @
19fd3bb6
...
...
@@ -17,6 +17,7 @@
#include
<TNL/SmartPointer.h>
#include
<cstring>
#include
<cstddef>
// std::nullptr_t
#include
"Devices/MIC.h"
...
...
@@ -36,9 +37,13 @@ class UniquePointer< Object, Devices::Host > : public SmartPointer
typedef
Object
ObjectType
;
typedef
Devices
::
Host
DeviceType
;
typedef
UniquePointer
<
Object
,
Devices
::
Host
>
ThisType
;
UniquePointer
(
std
::
nullptr_t
)
:
pointer
(
nullptr
)
{}
template
<
typename
...
Args
>
UniquePointer
(
const
Args
...
args
)
explicit
UniquePointer
(
const
Args
...
args
)
{
this
->
pointer
=
new
Object
(
args
...
);
}
...
...
@@ -126,7 +131,12 @@ class UniquePointer< Object, Devices::Cuda > : public SmartPointer
typedef
Object
ObjectType
;
typedef
Devices
::
Cuda
DeviceType
;
typedef
UniquePointer
<
Object
,
Devices
::
Cuda
>
ThisType
;
UniquePointer
(
std
::
nullptr_t
)
:
pd
(
nullptr
),
cuda_pointer
(
nullptr
)
{}
template
<
typename
...
Args
>
explicit
UniquePointer
(
const
Args
...
args
)
:
pd
(
nullptr
),
...
...
@@ -304,10 +314,15 @@ class UniquePointer< Object, Devices::MIC > : public SmartPointer
typedef
Devices
::
MIC
DeviceType
;
typedef
UniquePointer
<
Object
,
Devices
::
MIC
>
ThisType
;
UniquePointer
(
std
::
nullptr_t
)
:
pd
(
nullptr
),
mic_pointer
(
nullptr
)
{}
template
<
typename
...
Args
>
explicit
UniquePointer
(
const
Args
...
args
)
:
pd
(
nullptr
),
cuda
_pointer
(
nullptr
)
mic
_pointer
(
nullptr
)
{
this
->
allocate
(
args
...
);
}
...
...
@@ -458,7 +473,7 @@ class UniquePointer< Object, Devices::MIC > : public SmartPointer
PointerData
*
pd
;
//
cuda
_pointer can't be part of PointerData structure, since we would be
//
mic
_pointer can't be part of PointerData structure, since we would be
// unable to dereference this-pd on the device
Object
*
mic_pointer
;
};
...
...
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