🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #291

std streams and enum?

#291
From: Maya
Date: Mon, 22 Dec 2003 01:32
51 lines
3246 bytes
Can someone please help me?
I am using an enum type that I want to store in a std::IOStream object, 
but the compiler [complainer] tells me that the format is not supported. 
enum types are the same as 'const int' right? So, there should not be a 
problem!

namespace jme{
enum account_t {Zero, One, Two};
class Account{
protected:
    account_t type;

    ....
public:
    friend std::istream&
       jme::operator>>(std::istream& is, jme::Account& obj){
           is >> obj.type;  // <<======== Here is the problem ****
           return is;
       }
};
}
This gives me an error that reads:
====================================================
account.H: In function `std::istream& jme::operator>>(std::istream&,
    jme::Account&)':
account.H:91: no match for `std::basic_istream<char, 
std::char_traits<char> >&
    >> jme::account_t&' operator <<<<<<<====== This is the problem *****
...: candidates are:

/* Gives me a list of other candidates */

====================================================

Thanks in advance
-- 

FYI
http://www.astro.umd.edu/~marshall/abbrev.html

E-Mail Policy
http://www.vif.com/users/escalante/Email_Policy.html

* You cannot exercise your power to a point of humiliation.
                                - Jean Chretien

* The media's the most powerful entity on earth. They have the
   power to make the innocent guilty and to make the guilty
   innocent, and that's power.
                                 - Malcom X
* "Innocent until proven guilty", no... not in Canada!!
Technical Details
Message-ID: <3FE649C1.70108@netscape.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!worldnet.att.net!216.166.71.14!border3.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.vif.com!news.vif.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114592,d75aa99f09707fdd,start
X-Google-Attributes: gid114592,public
X-Google-Thread: fa69e,d75aa99f09707fdd,start
X-Google-Attributes: gidfa69e,public
X-Google-ArrivalTime: 2003-12-21 14:24:50 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!worldnet.att.net!216.166.71.14!border3.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.vif.com!news.vif.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 21 Dec 2003 16:24:49 -0600
Message-ID: <3FE649C1.70108@netscape.net>
Date: Sun, 21 Dec 2003 17:32:49 -0800
From: Maya <EscalanteCanada@netscape.net>
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en, en-ca, es, es-sv
MIME-Version: 1.0
Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cpp.borlandcpp
To:  dev-cpp-users@lists.sourceforge.net
Subject: std streams and enum?
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Organization: VIF Internet b4
Cache-Post-Path: www.vif.com!unknown@ip216-239-79-201.vif.net
X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/)
Lines: 52
NNTP-Posting-Host: 65.94.7.29
X-Trace: sv3-xM55Q7iBZHE0w0P4ChC2dYrrEcKfiK3OsXWw5E3ke66G69xeqNfbXu4X8L8NLQK1zJAkAulbtJDnv6I!AaO6RJas+Xc/mcopNjqQagbHGcUKPqV/dNtd5OTsRP4o38SC3Z3KVg53
X-Complaints-To: abuse@vif.com
X-DMCA-Complaints-To: abuse@vif.com
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.1