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

  • Home
  • SEARCH
  • 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 8611375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:21:37+00:00 2026-06-12T04:21:37+00:00

I don’t understand this cryptic error message but I get 30 of `’value_type’ :

  • 0

I don’t understand this cryptic error message but I get 30 of

`'value_type' : is not a member of 'TextFileLineBuffer'` 

when I compiled following code in VC++ 6 with //*** lines uncommented.

Of course, if I commented it out, it compiles fine.

I think I tried various attempts in vain for last two hours.
Any tip would be appreciated.

#include <list>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iterator>

//wrapper for a string line
struct TextLine
{
    std::string m_sLineContent;
    operator std::string const& () const { return m_sLineContent; }
    friend std::istream& operator>>(std::istream& stream, TextLine& line)
    {
        return std::getline(stream, line.m_sLineContent);
    }
};

//this is a version of fixed size of string queue for easy text file reading
class TextFileLineBuffer
{
    public:
        TextFileLineBuffer(size_t lc, const char* fileName)
            : m_iLineCount(lc), m_sFileName(fileName)
        {
            std::ifstream   file(fileName);
            //***   std::copy(std::istream_iterator<TextLine>(file), 
            //***           std::istream_iterator<TextLine>(),
            //***           std::back_inserter(*this));
        }
        void push_back(std::string const& line)
        {
            m_sBuffer.insert(m_sBuffer.end(),line);
            if (m_sBuffer.size() > m_iLineCount)
            {
                m_sBuffer.erase(m_sBuffer.begin());
            }
        }
        const char* c_str() const
        {
            std::string returnValue("");
            for (const_iterator it = begin(); it != end(); ++it) 
            {
                returnValue = returnValue + *it;
            }
            return returnValue.c_str();
        }
        typedef std::list<std::string>          Container;
        typedef Container::const_iterator       const_iterator;
        typedef Container::const_reference      const_reference;

        const_iterator begin()  const       { return m_sBuffer.begin(); }
        const_iterator end()    const       { return m_sBuffer.end();}

    private:
        size_t                      m_iLineCount;
        std::list<std::string>      m_sBuffer;
        std::string                 m_sFileName;
};    
  • 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-12T04:21:38+00:00Added an answer on June 12, 2026 at 4:21 am

    According to the standard (24.5.2.1 [back.insert.iterator]), back_insert_iterator requires that your Container type contain a value_type typedef, which should name the base type of the (const reference or rvalue reference) argument to push_back:

    class TextFileLineBuffer
    {
    public:
        // ...
        typedef std::string value_type;
    

    For compatibility with C++98, you should also define const_reference, per std::back_inserter needs const_reference on older GCC. Why?:

        typedef const std::string &const_reference;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know if this question is trivial or not. But after a couple
Don't ask me how but I managed to get accidentally the following remote branches
Don't know if I'm over-thinking this or not.. but I'm trying to be able
Don't quite understand why this copy constructor is not invoked when I build with
Don't dismiss this as a newbie question! It's not, I'm not, I've tried everything,
Don't know why but font is not displaying.Please help. CSS(in css folder): style.css: @font-face
Don't ask me why but I need to do the following: string ClassName =
I don't know why, but this code worked for me a month ago... maybe
don't know better title for this, but here's my code. I have class user
Don't ask why, but is there any way to suppress a failed linking error?

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.