Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalFMM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
solverstack
ScalFMM
Commits
910582b5
Commit
910582b5
authored
10 years ago
by
BRAMAS Berenger
Browse files
Options
Downloads
Patches
Plain Diff
Add copy constructor and operator from rvalue objects for the list and vectro
parent
548c9b34
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Src/Containers/FList.hpp
+28
-0
28 additions, 0 deletions
Src/Containers/FList.hpp
Src/Containers/FVector.hpp
+31
-0
31 additions, 0 deletions
Src/Containers/FVector.hpp
with
59 additions
and
0 deletions
Src/Containers/FList.hpp
+
28
−
0
View file @
910582b5
...
...
@@ -96,6 +96,34 @@ public:
copy
(
other
);
}
/**
* Copy operator
* This will clear the current list before copying
* @param other the source list
* @return the current list as a reference
*/
FList
&
operator
=
(
FList
&&
other
){
if
(
&
other
!=
this
){
clear
();
root
=
other
.
root
;
size
=
other
.
size
;
other
.
root
=
nullptr
;
other
.
size
=
0
;
}
return
*
this
;
}
/**
* Copy constructor
* @param other the source/original list
*/
FList
(
FList
&&
other
)
:
root
(
nullptr
)
,
size
(
0
)
{
root
=
other
.
root
;
size
=
other
.
size
;
other
.
root
=
nullptr
;
other
.
size
=
0
;
}
/**
* To clear the list
* Size is 0 after calling this function
...
...
This diff is collapsed.
Click to expand it.
Src/Containers/FVector.hpp
+
31
−
0
View file @
910582b5
...
...
@@ -77,6 +77,20 @@ public:
}
}
/**
* Copy constructor
* @param other original vector
* object must have an copy constructor
*/
FVector
(
FVector
&&
other
)
:
array
(
nullptr
),
capacity
(
0
),
index
(
0
)
{
array
=
other
.
array
;
capacity
=
other
.
capacity
;
index
=
other
.
index
;
other
.
array
=
nullptr
;
other
.
capacity
=
0
;
other
.
index
=
0
;
}
/** Copy operator
* @param other the original vector
* @return this after copying data
...
...
@@ -103,6 +117,23 @@ public:
return
*
this
;
}
/**
*@brief Copy operator
*/
FVector
&
operator
=
(
FVector
&&
other
){
if
(
&
other
!=
this
){
clear
();
delete
[]
reinterpret_cast
<
char
*
>
(
array
);
array
=
other
.
array
;
capacity
=
other
.
capacity
;
index
=
other
.
index
;
other
.
array
=
nullptr
;
other
.
capacity
=
0
;
other
.
index
=
0
;
}
return
(
*
this
);
}
/**
*@brief destructor
*/
...
...
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