Jump to content
  • Advertisement
Sign in to follow this  
3dcgmodeling

set operator= not work

This topic is 4079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Works on my machine just fine. Compiles correctly, and functions as one would expect it should, but that is without 'compare' specified. Your problem likely exists in a lack of a proper operator= function contained within 'compare'.


set<char*,compare> t1;
t1 = set<char*,compare>();// <- this line calls the operator= for set,
//which in turn calls operator= for both char* and compare.

set<char*,compare> t2=set<char*,compare>();//compiles into
//set<char*,compare> t2(set<char*,compare>());
//which calls only copy constructors, and no operator=!!!


For the sake of experimentation, try deleting 'compare' from both of your examples, and compile it again.

Of course, since no error message was provided, this is really just an educated guess based on my knowledge of the language, and the real problem could be any number of things that are wrong with the code outside of what is posted here, since 'compare' isn't specified in the posted code.

Oh, and whats with the 10,000 stl topics :P

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!