There is a strange error that I could not solve.
I have some files, Store.cpp, Store.h (class store is defined here), Order.cpp, Order.h (class order is defined here).
I have some sets and gates in the public section, one of them is: OrderStatus is an enumeration. When I'm trying to use it in Store.cpp from the following: I get this error from eclipse: and this error from GCC: If you want to add a convertible value to a key (which is irreversible for that reason), instead of There are mechanisms about it: does not work because I mentioned in a comment that there are two ways to avoid the problem, but both of them do this by changing the exact purity, and I recommend using one of them I not but, for completeness: This will compile, as the order changes in the class itself: Any of these can be irreversible in the order of Seriously, instead use the right data structure. #include "order.h" in Store.cpp.
Zero Setstats (Const. OrderStatus End) Order status);
(* ITR) .setStatus (ORDER_DONE);
Store.cpp: 250: 31: Error: There is no match for calling to order: setStatus (OrderStatus) constà ¢ Store Cpp: 250: 31: Note: The candidate is:
order.h: 47: 7: Note: Zero order :: Setstats (Const. Orderstats & amp;) order.h: 47: 7: Note: No known conversion for unbalanced ¢  ¢ Order to ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, ¢ ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, © Where I came from const actually Do not know (Line 250). std :: set unchangeable value type Used to store them should be irreversible, because otherwise you can break the barriers randomly while changing them.
std :: map Use.
std :: set & lt; Order & gt; :: Iterator IARR = ...; Iter- & gt; SetStatus (ORDER_DONE);
* iter yields
order treaty and and your method is not const.
const_cast & lt; Order & amp; & Gt; (* Iter) .setStatus (ORDER_DONE);
class command {mutual orderstats status; Public: Zero setstats (orderstats) const {status = s; }};
std :: set if the status is used in comparison, the first version says "just trust me" And is completely right in the right way, while the other clearly states that the condition is not the "real" part of the state of the object and it will not be used for sorting.
No comments:
Post a Comment