0

I have problem with creating vector of complex structures within boost::interprocess using msvc2008. Answers of questions asked before (links below) provides some solutions, but none of them works with msvc2008. Error type is always the same:

error: no match for ‘operator=’ (operand types are ‘complex_data’ and ‘const complex_data’) 

Previous questions about the problem:

Shared memory Vectors in boost with

How to I create a boost interprocess vector of interprocess containers?

Suggested solutions:

http://coliru.stacked-crooked.com/a/10000376928990e2

http://coliru.stacked-crooked.com/a/3d6582c2d59015d2

Note: I know I should move to newer versions of Visual Studio. But sadly, I am currently stuck with msvc2008.

Community
  • 1
  • 1
gidorah
  • 57
  • 7
  • 2
    You should consider to upgrade to a more recent tool. – Jabberwocky Mar 02 '17 at 09:27
  • You don't say? (Nicholas Cage meme is staring at you sarcastically). Just joking, one our vital tools is not upgradable. So I am kind of stuck with that at the moment. – gidorah Mar 02 '17 at 10:08
  • So you're stuck with Visual Studio 2008 ?? – Jabberwocky Mar 02 '17 at 10:14
  • Yeah, the tool (a library we can say) we are talking about is compiled with msvc2008. So I should compile my project with msvc2008 compiler. – gidorah Mar 02 '17 at 10:19
  • OK, you should specify that in your question. And there is no way you cat get compiled that library with modern tools? – Jabberwocky Mar 02 '17 at 10:20
  • This is the current situation I can say. There is a newer version of it (with C++11), but buying it is beyond my control. So to continiue doing what I do right now I need to do it with msvc2008. Thank you for your suggestion, I will specify that. – gidorah Mar 02 '17 at 10:46
  • 2
    Just a thought: the people who decide if a modern devtool should be bought should consider the time you spend searching a solution vs. the cost of a modern devtool + additional benefits of the modern tool.. – Jabberwocky Mar 02 '17 at 10:48
  • Can you show the actual code you're trying to compile? – sehe Mar 02 '17 at 15:35

1 Answers1

0

Without knowing your actual code, it looks as if you should perhaps add operator= for your type because MSVC is not able to generate it (?).

//Other members...
complex_data& operator=(complex_data const&) = default;

Or if the compiler doesn't take that hint, define the body the old-fashioned way:

complex_data& operator=(complex_data const& rhs) {
    id_ = rhs.id_;
    char_string_ = rhs.char_string_;
    int_vector_ = rhs.int_vector_;
    return *this;
}
sehe
  • 374,641
  • 47
  • 450
  • 633
  • You can consider first suggested solution I gave in the question is the exact code I am trying to compile. Actually, I think this is great because it is your solution. But i see that you say you cannot reproduce the error. – gidorah Mar 02 '17 at 17:46
  • This is strange, are you trying to compile with Visual Studio 2008? – gidorah Mar 02 '17 at 17:52
  • I didn't say I couldn't reproduce it. I will not try to. I can look at the code sample and imagine what hints MSVC would require - which is my answer. Your comment confuses me because the ["first suggested solution \[you\] gave in the question"](http://coliru.stacked-crooked.com/a/10000376928990e2) doesn't even contain the type referred to in the error message. – sehe Mar 03 '17 at 23:45