Skip to content

Commit

Permalink
Upstream is introducing newSeqUninit nim-lang/Nim#22586 (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
mratsim authored Aug 31, 2023
1 parent aebe967 commit fc9dbe7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/arraymancer/private/sequninit.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

func newSeqUninit*[T](len: Natural): seq[T] {.inline.} =
## Creates an uninitialzed seq.
## Contrary to newSequnitialized in system.nim this works for any subtype T
result = newSeqOfCap[T](len)
result.setLen(len)
when not declared(newSeqUninit):
# https://github.com/nim-lang/Nim/pull/22586#issuecomment-1698160304

func newSeqUninit*[T](len: Natural): seq[T] {.inline.} =
## Creates an uninitialzed seq.
## Contrary to newSequnitialized in system.nim this works for any subtype T
result = newSeqOfCap[T](len)
result.setLen(len)

0 comments on commit fc9dbe7

Please sign in to comment.