Lemdro.id
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
gracicot@programming.dev to C++@programming.dev · 2 years ago

Why does the compiler complain about a missing constructor when I'm just resizing my std::vector to a smaller size?

devblogs.microsoft.com

external-link
message-square
3
link
fedilink
8
external-link

Why does the compiler complain about a missing constructor when I'm just resizing my std::vector to a smaller size?

devblogs.microsoft.com

gracicot@programming.dev to C++@programming.dev · 2 years ago
message-square
3
link
fedilink
Why does the compiler complain about a missing constructor when I'm just resizing my std::vector to a smaller size? - The Old New Thing
devblogs.microsoft.com
external-link
The compiler doesn't know that you're shrinking.
alert-triangle
You must log in or register to comment.
  • Arkaniol@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    Thank you. But why not just init the vector std::vector vect(56) And then resize 🧐

    • KRAW@linux.community
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      That vector constructor still requires a default constructor for the class of the object contained by the vector, so it’s the same issue but different context.

  • rmam@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    2 years ago

    deleted by creator

    • gracicot@programming.devOP
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      I saw the article on my mastodon feed. When it’s interesting I usually post it here

C++@programming.dev

cpp@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !cpp@programming.dev

The center for all discussion and news regarding C++.

Rules

  • Respect instance rules.
  • Don’t be a jerk.
  • Please keep all posts related to C++.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 25 users / week
  • 178 users / month
  • 350 users / 6 months
  • 2 local subscribers
  • 2.17K subscribers
  • 342 Posts
  • 632 Comments
  • Modlog
  • mods:
  • Nihili0@programming.dev
  • lysdexic@programming.dev
  • UI: 0.19.11
  • BE: 0.19.12
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org