wstring in union
        Posted  
        
            by Oops
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Oops
        
        
        
        Published on 2010-04-05T14:04:10Z
        Indexed on 
            2010/04/05
            14:13 UTC
        
        
        Read the original article
        Hit count: 138
        
c++
Hi,
I'd like to define a union, for reading special kind of binary files. The union should have two members one of int and the other a kind of string, or any other that's the question; what is the best way to do this?
union uu {  
    int intval;  
    wstring strval;  
    uu(){ memset(this, 0, sizeof(this)); }  
}
it says: "Member strval of union has copy constructor" I think strval should have a * or a &; how would you define it?
thanks in advance
Oops
© Stack Overflow or respective owner