Skip to content

Commit 17be8ae

Browse files
swolchokfacebook-github-bot
authored andcommitted
[pytorch] Remove c10::nullopt_t::init (#47013)
Summary: Pull Request resolved: #47013 It was getting used in client code, and it's not part of `std::optional`. ghstack-source-id: 115769682 Test Plan: Existing tests Reviewed By: smessmer Differential Revision: D24547710 fbshipit-source-id: a24e0fd03aba1cd996c85b12bb5dcdb3e7af46b5
1 parent 7ab843e commit 17be8ae

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

aten/src/ATen/TensorIndexing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const int64_t INDEX_MIN = std::numeric_limits<int64_t>::min();
1313

1414
enum class TensorIndexType { None, Ellipsis, Integer, Boolean, Slice, Tensor };
1515

16-
constexpr c10::nullopt_t None{c10::nullopt_t::init()};
16+
constexpr c10::nullopt_t None = c10::nullopt;
1717

1818
struct CAFFE2_API EllipsisIndexType final { EllipsisIndexType() {} };
1919
CAFFE2_API extern const EllipsisIndexType Ellipsis;

c10/util/Optional.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,9 @@ constexpr struct trivial_init_t {
137137

138138
// 20.5.7, Disengaged state indicator
139139
struct nullopt_t {
140-
struct init {};
141-
constexpr explicit nullopt_t(init) {}
140+
constexpr explicit nullopt_t(int) {}
142141
};
143-
constexpr nullopt_t nullopt{nullopt_t::init()};
142+
constexpr nullopt_t nullopt {0};
144143

145144
// 20.5.8, class bad_optional_access
146145
class bad_optional_access : public std::logic_error {

0 commit comments

Comments
 (0)