Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8827831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:27:56+00:00 2026-06-14T07:27:56+00:00

Under the (false?) impression that boost::container::flat_set was a drop-in replacement of std::set , I

  • 0

Under the (false?) impression that boost::container::flat_set was a drop-in replacement of std::set, I replaced set with flat_set wherever I expected the number of element to be small and the search performance is more critical than inserts.

At a later stage, I was stumped by a confusing compilation error which I eventually traced to the use of flat_set as a class member.

For example:

class Room {
  private:
    boost::container::flat_set<int> v;
};

The following code will not compile, but works just fine if I replace flat_set with std::set.

Room a;
Room b = Room(); // Example 1. Compiles OK
a = b;           // Example 2. Compiles OK
a = Room();      // Example 3. Eeeek! Compile fails on this line

The compilation error I see is:

error: no match for ‘operator=’ in ‘a = Room()’
note: candidate is:
note: Room& Room::operator=(Room&)
note:   no known conversion for argument 1 from ‘Room’ to ‘Room&’

My questions are:

  1. Is this error expected? If it is, then how do I work round it?
  2. How are the three statements in the example code different, and why does only the last one fail?
  3. Why does the compiler complain about the assignment operator of Room rather than flat_set? Has the use of flat_set influenced the default operators generated for the class?

Complete sample program:

#include <boost/container/flat_set.hpp>

class Room {
  private:
    boost::container::flat_set<int> v;
};

int main(int argc, char *argv[]) {
  Room a;

  Room b = Room();
  a = b;
  a = Room();  // compilation fails here

  return 0;
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:27:57+00:00Added an answer on June 14, 2026 at 7:27 am

    This is a known limitation of the move emulation performed by Boost.Move. You can find more information about it here: http://www.boost.org/doc/libs/1_52_0/doc/html/move/emulation_limitations.html#move.emulation_limitations.assignment_operator

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was under the impression that || and or were synonymous. Setting variable with
Learning ruby. I'm under the impression that boolean attributes should be named as follows:
I was always under the impression that when you're running a process as (domain\user)
I am under the impression that the below code should work asynchronously. However, when
I've just started working with swt's canvas. I'm under the impression that draw commands
I was under the impression that the lazy seqs were always chunked. => (take
I was under the impression that conditions joined with && were executed in sequence,
I'm running the code below and I was under the impression that it did
Until today I was living under the impression that RSA encryption using RSA is
I was under the impression that = is an assignment, == is a numeric

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.