Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GeoModelDev
GeoModel
Commits
d2373620
Commit
d2373620
authored
1 year ago
by
Johannes Junggeburth
Browse files
Options
Downloads
Patches
Plain Diff
Update GeoIntrusivePtr.h
parent
899a530c
No related branches found
No related tags found
1 merge request
!264
Update GeoIntrusivePtr.h
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GeoModelCore/GeoModelKernel/GeoModelKernel/GeoIntrusivePtr.h
+11
-4
11 additions, 4 deletions
GeoModelCore/GeoModelKernel/GeoModelKernel/GeoIntrusivePtr.h
with
11 additions
and
4 deletions
GeoModelCore/GeoModelKernel/GeoModelKernel/GeoIntrusivePtr.h
+
11
−
4
View file @
d2373620
...
...
@@ -15,14 +15,14 @@ class GeoIntrusivePtr{
public:
template
<
typename
GeoTypeGrp
>
friend
class
GeoIntrusivePtr
;
explicit
GeoIntrusivePtr
()
noexcept
=
default
;
GeoIntrusivePtr
()
noexcept
=
default
;
// Standard constructor taking a bare pointer
GeoIntrusivePtr
(
GeoType
*
obj
)
noexcept
:
m_ptr
{
obj
}
{
if
(
m_ptr
)
obj
->
ref
();
}
/// Copy constructor
GeoIntrusivePtr
(
const
GeoIntrusivePtr
&
other
)
noexcept
:
explicit
GeoIntrusivePtr
(
const
GeoIntrusivePtr
&
other
)
noexcept
:
GeoIntrusivePtr
{
other
.
get
()}
{}
/// Copy constructor for derived types
...
...
@@ -50,6 +50,13 @@ class GeoIntrusivePtr{
reset
(
other
.
get
());
return
*
this
;
}
template
<
typename
GeoTypeGrp
,
typename
=
typename
std
::
enable_if
<!
std
::
is_same
<
GeoType
,
GeoTypeGrp
>
::
value
,
bool
>>
GeoIntrusivePtr
&
operator
=
(
const
GeoIntrusivePtr
<
GeoTypeGrp
>&
other
)
{
reset
(
other
.
get
());
return
*
this
;
}
GeoIntrusivePtr
&
operator
=
(
GeoType
*
other
)
noexcept
{
reset
(
other
);
return
*
this
;
...
...
@@ -66,7 +73,7 @@ class GeoIntrusivePtr{
}
template
<
typename
GeoTypeGrp
,
typename
=
typename
std
::
enable_if
<!
std
::
is_same
<
GeoType
,
GeoTypeGrp
>
::
value
,
bool
>>
GeoIntrusivePtr
&
operator
=
(
GeoIntrusivePtr
<
GeoTypeGrp
>&&
other
)
{
GeoIntrusivePtr
&
operator
=
(
GeoIntrusivePtr
<
GeoTypeGrp
>&&
other
)
{
if
(
m_ptr
&&
m_ptr
==
other
.
get
())
{
m_ptr
->
unref
();
}
else
{
...
...
@@ -104,7 +111,7 @@ class GeoIntrusivePtr{
template
<
class
GeoTypeGrp
>
bool
operator
==
(
const
GeoIntrusivePtr
<
GeoTypeGrp
>&
other
)
const
{
return
m_ptr
==
other
.
m_ptr
;
}
}
bool
operator
==
(
GeoType
*
other
)
const
{
return
m_ptr
==
other
;
}
...
...
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