Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
Timo Koch
dune-common
Commits
450d96a0
Commit
450d96a0
authored
12 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Added constructor from nullptr.
Make test runs through again. [[Imported from SVN: r7045]]
parent
9065323c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/common/shared_ptr.hh
+25
-9
25 additions, 9 deletions
dune/common/shared_ptr.hh
with
25 additions
and
9 deletions
dune/common/shared_ptr.hh
+
25
−
9
View file @
450d96a0
...
...
@@ -58,6 +58,8 @@ namespace Dune
*/
inline
shared_ptr
();
inline
shared_ptr
(
nullptr_t
null
);
/**
* @brief Constructs a new smart pointer from a preallocated Object.
*
...
...
@@ -69,6 +71,7 @@ namespace Dune
template
<
class
T1
>
inline
shared_ptr
(
T1
*
pointer
);
/**
* @brief Constructs a new smart pointer from a preallocated Object.
*
...
...
@@ -91,6 +94,12 @@ namespace Dune
template
<
class
T1
>
inline
shared_ptr
(
const
shared_ptr
<
T1
>&
pointer
);
/**
* @brief Copy constructor.
* @param pointer The object to copy.
*/
inline
shared_ptr
(
const
shared_ptr
&
pointer
);
/**
* @brief Destructor.
*/
...
...
@@ -160,14 +169,11 @@ namespace Dune
PointerRep
(
const
typename
shared_ptr
<
T1
>::
PointerRep
&
rep
)
:
count_
(
rep
.
count_
),
rep_
(
rep
.
rep_
)
{}
template
<
class
T1
>
operator
typename
shared_ptr
<
T1
>::
PointerRep
()
{
return
shared_ptr
<
T1
>::
PointerRep
(
*
this
);
}
/** @brief Destructor, deletes element_type* rep_. */
virtual
~
PointerRep
()
{};
private
:
template
<
class
T1
>
PointerRep
(
T1
*
p
,
int
count
)
:
count_
(
count
),
rep_
(
p
)
{}
};
/** @brief Adds call to deleter to PointerRep. */
...
...
@@ -224,6 +230,12 @@ namespace Dune
rep_
=
new
PointerRepImpl
<
DefaultDeleter
>
(
p
,
DefaultDeleter
());
}
template
<
class
T
>
inline
shared_ptr
<
T
>::
shared_ptr
(
nullptr_t
n
)
{
rep_
=
new
PointerRepImpl
<
DefaultDeleter
>
(
n
,
DefaultDeleter
());
}
template
<
class
T
>
template
<
class
T1
,
class
Deleter
>
inline
shared_ptr
<
T
>::
shared_ptr
(
T1
*
p
,
Deleter
deleter
)
...
...
@@ -239,10 +251,14 @@ namespace Dune
template
<
class
T
>
template
<
class
T1
>
inline
shared_ptr
<
T
>::
shared_ptr
(
const
shared_ptr
<
T1
>&
other
)
:
rep_
()
inline
shared_ptr
<
T
>::
shared_ptr
(
const
shared_ptr
<
T1
>&
other
)
:
rep_
(
new
PointerRep
(
other
.
rep_
->
rep_
,
other
.
rep_
->
count_
))
{
//Due to type conversion we have constructed a new RepPointer, no need to increment count.
}
template
<
class
T
>
inline
shared_ptr
<
T
>::
shared_ptr
(
const
shared_ptr
&
other
)
:
rep_
(
other
.
rep_
)
{
rep_
->
count_
=
other
.
rep_
->
count_
;
rep_
->
rep_
=
other
.
rep_
->
rep_
;
if
(
rep_
)
++
(
rep_
->
count_
);
}
...
...
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