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 7732117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:39:05+00:00 2026-06-01T06:39:05+00:00

I am trying to do the following: template <class T> std::ifstream& operator>> (std::ifstream& fin,

  • 0

I am trying to do the following:

template <class T>
std::ifstream& operator>> (std::ifstream& fin, List<T> l)
{
    T temp;
    l.resize(0);
    fin >> ignore(1,'\t');
    for(ListIterator<T> i=l.begin();i!=l.end();i++)
    {
        fin >> ignore(1,'\t') >> temp;
        l.push_back(temp);
    }
    return fin;
}

I have to read all the contents from a file. Each field is separated by '\t' character, so I have to ignore the '\t' characters.

The error log is the following:

/home/ramy/Documents/C++/Prova/Util.h||In function ‘std::ifstream& Util::operator>> (std::ifstream&, Util::List<T>)’:|
/home/ramy/Documents/C++/Prova/Util.h|431|error: there are no arguments to ‘ignore’ that  depend on a template parameter, so a declaration of ‘ignore’ must be available|
/home/ramy/Documents/C++/Prova/Util.h|431|note: (if you use ‘-fpermissive’, G++ will  accept your code, but allowing the use of an undeclared name is deprecated)|
||=== Build finished: 1 errors, 0 warnings ===|
  • 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-01T06:39:06+00:00Added an answer on June 1, 2026 at 6:39 am

    For builtin types, argument dependent lookup (ADL) is not performed, therefore, an ignore symbol must be “imported” into the current namespace.

    You can, for example, do this; from most preferred to least preferred (i.e. to most intrusive and name polluting):

    • foobar::ignore (...)
    • using foobar::ignore; ignore(...);
    • using namespace foobar; ignore(...);

    The error message comes up like this because in templates, you also enter the realm of dependent names and Two Phase Lookup. Names that depend on a template parameter, e.g.

    template <typename T> void foo() {
        T x;
        x.frobnicate();
    }
    

    are looked up in phase 2, which is upon instantiation. Names that do not depend on template parameters, like

    class Foo {};
    
    template <typename T> void foo() {
        Foo foo;
        foo.frobnicate();
    }
    

    must be resolvable in the first phase.

    This separation helps template authors to find bugs earlier and to find correct symbols, and it helps making templates more generic. For example, in C# generics, everything must be resolvable, which puts rather stringent limits on their flexibility (because everything that may be used by a generic must be defined). Oppositely, some old C++ compilers resolved in phase 2 only, i.e. at instantiation time, which had some subtle consequences for lookup and error finding.

    The C++ 2-phase model combines the best of the eager-model (C#) and the lazy-model (some old C++ compilers).

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

Sidebar

Related Questions

I have the following code: template <class T> static std::string ToString(const T& t) {
I have the following: using namespace std; template<class T> class olsm; template<class T> istream&
I have the following code: template<typename T, typename Allocator = std::allocator<T> > class Carray
I'm trying to implement the following in C++: template <class T> class Inner {
I have a template class Test, and I am trying to define the following
I'm trying to understand how the following class template works (taken from here ),
I am trying to specialize template the following way: template<size_t _1,size_t _2> // workaround:
I'm trying to create a linked list class in Eclipse but I can't get
I have the following little test application, where I'm trying to employ a template
I have been trying to implement my own linked list class for didactic purposes.

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.