[xsd-users] how do I...?

Boris Kolpackov boris at codesynthesis.com
Sat May 19 17:10:52 EDT 2007


Hi Michael,

Michael Coulman <michael.coulman at gmail.com> writes:

> if (!bc[ith].available ())
> 	bc.erase (std::remove (bc.begin (), bc.end (), bc[ith]));

I assume here you are trying to remove all instances of some book if
it is not available (though you forgot to pass bc.end () to erase as
a second argument). It won't work out of the box because there is no
operator== defined for class book. There are several ways to make it
work:

(1) Rewrite it as a loop.

(2) Create a functor that compares books and use std::remove_if.

(3) Define operator== for comparing books.


> Thanks for the great tool.

You are welcome! I am glad you are enjoying it.


hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070519/c81a914e/attachment.pgp


More information about the xsd-users mailing list