Restrict conversion to SmallVector#42694
Closed
smessmer wants to merge 1 commit intogh/smessmer/248/basefrom
Closed
Restrict conversion to SmallVector#42694smessmer wants to merge 1 commit intogh/smessmer/248/basefrom
smessmer wants to merge 1 commit intogh/smessmer/248/basefrom
Conversation
The old implementation allowed calling SmallVector constructor and operator= for any type without restrictions, but then failed with a compiler error when the type wasn't a collection. Instead, we should only use it if Container follows a container concept and just not match the constructor otherwise. This fixes an issue @kimishpatel was running into. Differential Revision: [D22983020](https://our.internmc.facebook.com/intern/diff/D22983020/) [ghstack-poisoned]
smessmer
added a commit
that referenced
this pull request
Aug 6, 2020
The old implementation allowed calling SmallVector constructor and operator= for any type without restrictions, but then failed with a compiler error when the type wasn't a collection. Instead, we should only use it if Container follows a container concept and just not match the constructor otherwise. This fixes an issue @kimishpatel was running into. Differential Revision: [D22983020](https://our.internmc.facebook.com/intern/diff/D22983020/) ghstack-source-id: 109370513 Pull Request resolved: #42694
💊 CI failures summary and remediationsAs of commit cc41a65 (more details on the Dr. CI page):
🕵️ 2 new failures recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
kimishpatel
reviewed
Aug 6, 2020
| } | ||
|
|
||
| template <typename Container> | ||
| // note: The enable_if restricts Container to types that have a .begin() and .end() |
Contributor
There was a problem hiding this comment.
Tested this locally. It works.
kimishpatel
approved these changes
Aug 6, 2020
Contributor
kimishpatel
left a comment
There was a problem hiding this comment.
Thanks for the fix Sebastian.
Contributor
|
This pull request has been merged in 95f4f67. |
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
Summary: Pull Request resolved: pytorch#42694 The old implementation allowed calling SmallVector constructor and operator= for any type without restrictions, but then failed with a compiler error when the type wasn't a collection. Instead, we should only use it if Container follows a container concept and just not match the constructor otherwise. This fixes an issue kimishpatel was running into. ghstack-source-id: 109370513 Test Plan: unit tests Reviewed By: kimishpatel, ezyang Differential Revision: D22983020 fbshipit-source-id: c31264f5c393762d822f3d64dd2a8e3279d8da44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
The old implementation allowed calling SmallVector constructor and operator= for any type without restrictions,
but then failed with a compiler error when the type wasn't a collection.
Instead, we should only use it if Container follows a container concept and just not match the constructor otherwise.
This fixes an issue @kimishpatel was running into.
Differential Revision: D22983020