Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7991001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:10:09+00:00 2026-06-04T13:10:09+00:00

I have a class with a stringstream: class NetMessageEncoder { std::stringstream m_ss; std::stringstream m_numSS;

  • 0

I have a class with a stringstream:

class NetMessageEncoder
{
    std::stringstream m_ss;
    std::stringstream m_numSS;
public:
    NetMessageEncoder();
    void beginMessage();

…

I then have another class with an instance of this class in it that I’m trying to make a vector of:

m_games.resize(100);

This line produces:

Error   1   error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'    c:\Program Files\Microsoft Visual Studio 9.0\VC\include\sstream 516

I gather that it might be because the vector needs to copy the class with I guess causes the stringstream to copy by value or something?

The stringstream is indeed the cause, compiles fine if removed.

Is there a way to fix this?

Thanks

    struct TableS
    {
        ServerPlayer* m_players[4];
        SpadesGameInfo m_info;
        NetSpadesGame m_game;
        bool readyToPlay() const
        {
            int count = 0;
            for(int i = 0; i < 4; ++i)
            {
                if(m_players[i])
                {
                    count++;
                }
            }

            return count >= m_info.getNumPlayers();
        }
        TableS()
        {
            for(int i = 0; i < 4; ++i)
            {
                m_players[i] = NULL;
            }
        }
    };
    class ServerCore : public ServerHost, public NetEventListener
    {
        NetEventDecoder m_dec;
        NetEventEncoder m_enc;
        std::vector<ServerPlayer*> m_players;
        int m_totalPlayers;
        std::vector<TableS> m_games;
    public:
...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:10:11+00:00Added an answer on June 4, 2026 at 1:10 pm

    You can do one of the followings:

    1) Override copy constructor and assignment operator of NetMessageEncoder and deal with stream copying yourself (using a new stream for the copy could be enough in your case, I guess)

    2) Avoid copying of streams by using std::vector<TableS*> m_games; instead of std::vector<TableS> m_games;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have: class BASE{ public: virtual void func1() = 0; }; Then I have
I have the following class(prototipe): class Token { public: //members, etc. friend std::stringstream& operator<<
I have a class that extends ostringstream class. Class A: public ostringstream { }
I have the following class: namespace { class MimeLogger : public std::ostringstream { public:
I have the following class: class StringHolder { public: StringHolder(std::string& str) { m_str =
I have a class that holds a reference to a stringstream (used as an
I have Class which Extends View I'm able To Move one Image Over another
If I have 10 different objects serialized/deserialized using a Generic T class that uses
I have a network client with a request method that takes a std::streambuf* .
I have the following code: template <class T> static std::string ToString(const T& t) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.