Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
cc4915bb
Commit
cc4915bb
authored
6 years ago
by
Enrico Guiraud
Committed by
Danilo Piparo
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[VecOps][NFC] Formatting of RAdoptAllocator
parent
5927f141
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
math/vecops/inc/ROOT/RAdoptAllocator.hxx
+11
-15
11 additions, 15 deletions
math/vecops/inc/ROOT/RAdoptAllocator.hxx
with
11 additions
and
15 deletions
math/vecops/inc/ROOT/RAdoptAllocator.hxx
+
11
−
15
View file @
cc4915bb
...
@@ -47,7 +47,6 @@ v.emplace_back(0.);
...
@@ -47,7 +47,6 @@ v.emplace_back(0.);
now the vector *v* owns its memory as a regular vector.
now the vector *v* owns its memory as a regular vector.
**/
**/
template
<
typename
T
>
template
<
typename
T
>
class
RAdoptAllocator
{
class
RAdoptAllocator
{
public:
public:
...
@@ -61,8 +60,11 @@ public:
...
@@ -61,8 +60,11 @@ public:
using
const_reference
=
typename
StdAlloc_t
::
const_reference
;
using
const_reference
=
typename
StdAlloc_t
::
const_reference
;
using
size_type
=
typename
StdAlloc_t
::
size_type
;
using
size_type
=
typename
StdAlloc_t
::
size_type
;
using
difference_type
=
typename
StdAlloc_t
::
difference_type
;
using
difference_type
=
typename
StdAlloc_t
::
difference_type
;
template
<
typename
U
>
template
<
typename
U
>
struct
rebind
{
using
other
=
RAdoptAllocator
<
U
>
;
};
struct
rebind
{
using
other
=
RAdoptAllocator
<
U
>
;
};
private
:
private
:
enum
class
EAllocType
:
char
{
kOwning
,
kAdopting
,
kAdoptingNoAllocYet
};
enum
class
EAllocType
:
char
{
kOwning
,
kAdopting
,
kAdoptingNoAllocYet
};
using
StdAllocTraits_t
=
std
::
allocator_traits
<
StdAlloc_t
>
;
using
StdAllocTraits_t
=
std
::
allocator_traits
<
StdAlloc_t
>
;
...
@@ -72,8 +74,7 @@ private:
...
@@ -72,8 +74,7 @@ private:
public
:
public
:
/// This is the constructor which allows the allocator to adopt a certain memory region.
/// This is the constructor which allows the allocator to adopt a certain memory region.
RAdoptAllocator
(
pointer
p
)
RAdoptAllocator
(
pointer
p
)
:
fInitialAddress
(
p
),
fAllocType
(
EAllocType
::
kAdoptingNoAllocYet
){};
:
fInitialAddress
(
p
),
fAllocType
(
EAllocType
::
kAdoptingNoAllocYet
){};
RAdoptAllocator
()
=
default
;
RAdoptAllocator
()
=
default
;
RAdoptAllocator
(
const
RAdoptAllocator
&
)
=
default
;
RAdoptAllocator
(
const
RAdoptAllocator
&
)
=
default
;
RAdoptAllocator
(
RAdoptAllocator
&&
)
=
default
;
RAdoptAllocator
(
RAdoptAllocator
&&
)
=
default
;
...
@@ -129,27 +130,22 @@ public:
...
@@ -129,27 +130,22 @@ public:
bool
operator
==
(
const
RAdoptAllocator
<
T
>
&
other
)
bool
operator
==
(
const
RAdoptAllocator
<
T
>
&
other
)
{
{
return
fInitialAddress
==
other
.
fInitialAddress
&&
return
fInitialAddress
==
other
.
fInitialAddress
&&
fAllocType
==
other
.
fAllocType
&&
fAllocType
==
other
.
fAllocType
&&
fStdAllocator
==
other
.
fStdAllocator
;
fStdAllocator
==
other
.
fStdAllocator
;
}
}
bool
operator
!=
(
const
RAdoptAllocator
<
T
>
&
other
)
bool
operator
!=
(
const
RAdoptAllocator
<
T
>
&
other
)
{
return
!
(
*
this
==
other
);
}
{
return
!
(
*
this
==
other
);
}
template
<
class
U
>
template
<
class
U
>
void
destroy
(
U
*
p
)
void
destroy
(
U
*
p
)
{
{
if
(
EAllocType
::
kAdopting
!=
fAllocType
)
{
if
(
EAllocType
::
kAdopting
!=
fAllocType
)
{
fStdAllocator
.
destroy
(
p
);
fStdAllocator
.
destroy
(
p
);
}
}
}
}
};
};
}
// End NS VecOps
}
// End NS VecOps
}
// End NS
Interna
l
}
// End NS
Detai
l
}
// End NS ROOT
}
// End NS ROOT
#endif
#endif
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