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
da898965
Commit
da898965
authored
7 years ago
by
Enrico Guiraud
Browse files
Options
Downloads
Patches
Plain Diff
[TTreeReader] Fix "int + TTreeReaderArray::Iterator_t"
Thanks Axel!
parent
be58dfc5
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
tree/treeplayer/inc/TTreeReaderArray.h
+1
-7
1 addition, 7 deletions
tree/treeplayer/inc/TTreeReaderArray.h
tree/treeplayer/test/readerarray_iterator.cxx
+1
-3
1 addition, 3 deletions
tree/treeplayer/test/readerarray_iterator.cxx
with
2 additions
and
10 deletions
tree/treeplayer/inc/TTreeReaderArray.h
+
1
−
7
View file @
da898965
...
...
@@ -154,6 +154,7 @@ public:
}
Iterator_t
operator
+
(
std
::
ptrdiff_t
n
)
const
{
return
Iterator_t
(
fIndex
+
n
,
fArray
);
}
friend
auto
operator
+
(
std
::
ptrdiff_t
n
,
const
Iterator_t
&
it
)
->
decltype
(
it
+
n
)
{
return
it
+
n
;
}
Iterator_t
operator
-
(
std
::
ptrdiff_t
n
)
const
{
...
...
@@ -207,11 +208,4 @@ protected:
// ClassDefT(TTreeReaderArray, 0);//Accessor to member of an object stored in a collection
};
// FIXME: `n + it` cannot use this overload of operator+ because T cannot be deduced from the type of the iterator
template
<
typename
T
>
auto
operator
+
(
std
::
ptrdiff_t
n
,
const
typename
TTreeReaderArray
<
T
>::
iterator
&
it
)
->
decltype
(
it
+
n
)
{
return
it
+
n
;
}
#endif // ROOT_TTreeReaderArray
This diff is collapsed.
Click to expand it.
tree/treeplayer/test/readerarray_iterator.cxx
+
1
−
3
View file @
da898965
...
...
@@ -64,9 +64,7 @@ void TestReaderArray()
it
=
it3
++
;
EXPECT_EQ
(
it
+=
1
,
it3
);
// FIXME: `n + it` does not resolve to the right operator+
// EXPECT_EQ((std::ptrdiff_t(2) + arr.begin()) - 1, --(arr.begin() + 2));
EXPECT_EQ
((
arr
.
begin
()
+
2
)
-
1
,
--
(
arr
.
begin
()
+
2
));
EXPECT_EQ
((
std
::
ptrdiff_t
(
2
)
+
arr
.
begin
())
-
1
,
--
(
arr
.
begin
()
+
2
));
it
=
std
::
move
(
it3
);
auto
it4
=
it
--
;
EXPECT_EQ
(
it4
-=
1
,
it
);
...
...
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