From: Scott Wolchok Date: Wed, 15 Sep 2021 16:55:02 +0000 (-0700) Subject: [PyTorch][easy] Add cbegin/cend to SmallVector (#64682) X-Git-Tag: accepted/tizen/8.0/unified/20231005.095509~196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=57420a6063295a5008bd5f22ae126f8fa14cd1d2;p=platform%2Fupstream%2Fpytorch.git [PyTorch][easy] Add cbegin/cend to SmallVector (#64682) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64682 Looks like it was forked from llvm before cbegin and cend existed. ghstack-source-id: 138036981 Test Plan: CI Reviewed By: dhruvbird Differential Revision: D30814434 fbshipit-source-id: 9740fa8d3df1c90b77298a95ab9f1d0cf8c90320 --- diff --git a/c10/util/SmallVector.h b/c10/util/SmallVector.h index 38b2653..5684263 100644 --- a/c10/util/SmallVector.h +++ b/c10/util/SmallVector.h @@ -139,12 +139,18 @@ class SmallVectorTemplateCommon : public SmallVectorBase { return (iterator)this->BeginX; } const_iterator begin() const { + return cbegin(); + } + const_iterator cbegin() const { return (const_iterator)this->BeginX; } iterator end() { return (iterator)this->EndX; } const_iterator end() const { + return cend(); + } + const_iterator cend() const { return (const_iterator)this->EndX; }