Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
094a5ba8
Commit
094a5ba8
authored
6 years ago
by
Jan Trávníček
Browse files
Options
Downloads
Patches
Plain Diff
update of cow_shared_ptr
parent
d71d12c9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
alib2std/src/extensions/memory.hpp
+63
-0
63 additions, 0 deletions
alib2std/src/extensions/memory.hpp
with
63 additions
and
0 deletions
alib2std/src/extensions/memory.hpp
+
63
−
0
View file @
094a5ba8
...
@@ -69,6 +69,16 @@ public:
...
@@ -69,6 +69,16 @@ public:
cow_shared_ptr
(
const
cow_shared_ptr
&
other
)
:
std
::
shared_ptr
<
T
>
(
other
)
{
cow_shared_ptr
(
const
cow_shared_ptr
&
other
)
:
std
::
shared_ptr
<
T
>
(
other
)
{
}
}
/**
*
\
brief
*
Copy
version
of
user
conversion
constructor
to
create
new
instance
of
shared
pointer
reffering
the
same
data
.
*
*
\
param
other
the
source
instance
*/
template
<
class
Y
>
cow_shared_ptr
(
const
cow_shared_ptr
<
Y
>
&
other
)
:
std
::
shared_ptr
<
T
>
(
other
)
{
}
/**
/**
*
\
brief
*
\
brief
*
Move
constructor
to
create
new
instance
of
shared
pointer
reffering
the
same
data
.
*
Move
constructor
to
create
new
instance
of
shared
pointer
reffering
the
same
data
.
...
@@ -78,6 +88,16 @@ public:
...
@@ -78,6 +88,16 @@ public:
cow_shared_ptr
(
cow_shared_ptr
&&
other
)
noexcept
:
std
::
shared_ptr
<
T
>
(
std
::
move
(
other
)
)
{
cow_shared_ptr
(
cow_shared_ptr
&&
other
)
noexcept
:
std
::
shared_ptr
<
T
>
(
std
::
move
(
other
)
)
{
}
}
/**
*
\
brief
*
Move
version
of
user
conversion
constructor
to
create
new
instance
of
shared
pointer
reffering
the
same
data
.
*
*
\
param
other
the
source
instance
*/
template
<
class
Y
>
cow_shared_ptr
(
cow_shared_ptr
<
Y
>
&&
other
)
noexcept
:
std
::
shared_ptr
<
T
>
(
std
::
move
(
other
)
)
{
}
/**
/**
*
\
brief
*
\
brief
*
The
destructor
of
the
shared
pointer
.
*
The
destructor
of
the
shared
pointer
.
...
@@ -96,6 +116,18 @@ public:
...
@@ -96,6 +116,18 @@ public:
return
*
this
;
return
*
this
;
}
}
/**
*
\
brief
*
Copy
version
of
user
conversion
assignment
operator
to
change
reffered
instace
to
source
one
.
*
*
\
param
other
the
source
instance
*/
template
<
class
Y
>
cow_shared_ptr
&
operator
=
(
const
cow_shared_ptr
<
Y
>
&
other
)
{
static_cast
<
std
::
shared_ptr
<
T
>
&
>
(
*
this
)
=
static_cast
<
const
std
::
shared_ptr
<
T
>
&
>
(
other
);
return
*
this
;
}
/**
/**
*
\
brief
*
\
brief
*
Move
assignment
operator
to
change
reffered
instace
to
source
one
.
*
Move
assignment
operator
to
change
reffered
instace
to
source
one
.
...
@@ -107,6 +139,37 @@ public:
...
@@ -107,6 +139,37 @@ public:
return
*
this
;
return
*
this
;
}
}
/**
*
\
brief
*
Move
version
of
user
conversion
assignment
operator
to
change
reffered
instace
to
source
one
.
*
*
\
param
other
the
source
instance
*/
template
<
class
Y
>
cow_shared_ptr
&
operator
=
(
cow_shared_ptr
<
Y
>
&&
other
)
noexcept
{
static_cast
<
std
::
shared_ptr
<
T
>
&
>
(
*
this
)
=
static_cast
<
std
::
shared_ptr
<
T
>
&&
>
(
other
);
return
*
this
;
}
/**
*
\
brief
*
Sets
the
shared
pointer
to
nullptr
.
*/
void
reset
(
)
noexcept
{
return
std
::
shared_ptr
<
T
>::
reset
(
);
}
/**
*
\
brief
*
Sets
the
shared
pointer
to
value
.
*
*
\
param
ptr
the
value
to
store
*/
template
<
class
Y
>
void
reset
(
Y
*
ptr
)
{
return
std
::
shared_ptr
<
T
>::
reset
(
ptr
);
}
/**
/**
*
\
brief
*
\
brief
*
Operator
arrow
to
chain
dereferece
to
inner
managed
pointer
.
*
Operator
arrow
to
chain
dereferece
to
inner
managed
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