Linux.Community
  • 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.
  • KRAW
    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.

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.

  • 2 users / day
  • 20 users / week
  • 48 users / month
  • 187 users / 6 months
  • 2 local subscribers
  • 2.02K subscribers
  • 293 Posts
  • 580 Comments
  • Modlog
  • mods:
  • farados@vlemmy.net
  • Nihili0@programming.dev
  • lysdexic@programming.dev
  • BE: 0.19.11
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org