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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:26:02+00:00 2026-05-27T05:26:02+00:00

Possible Duplicate: Why is it an error to use an empty set of brackets

  • 0

Possible Duplicate:
Why is it an error to use an empty set of brackets to call a constructor with no arguments?

The small piece code code can not be successfully compiled on
Microsoft Visual Studio 2005

#include <iterator>
#include <algorithm>
#include <vector>
#include <iostream>

int main()
{
    std::vector<int> a;
    std::istream_iterator<int> be(std::cin);
    std::istream_iterator<int> en();
    std::copy(be, en, std::back_inserter(a));       
}

But this one is ok

#include <iterator>
#include <algorithm>
#include <vector>
#include <iostream>

int main()
{
    std::vector<int> a;
    std::istream_iterator<int> be(std::cin);
    std::istream_iterator<int> en; //Same to upon, only here less '()'
    std::copy(be, en, std::back_inserter(a));       
}
  • 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-05-27T05:26:02+00:00Added an answer on May 27, 2026 at 5:26 am

    In the first case en is being declared as a function, not a variable. This is one of the many traps present in C++ syntax that makes hard to parse a C++ program.

    The rule applied is more or less “if it can be parsed both as a declaration or as a definition then it’s considered a declaration” and has been named “most vexing parse” by Scott Meyers. In your case the second line can be seen similar to

    inf foo();
    

    And is therefore considered a function declaration. Note that this very same trap can be even more subtle:

    double x = 3.141592654;
    int y(int(x));
    

    here the second line is also a declaration for a function because language rules says here that the parenthesis around x can be ignored and therefore the meaning is int y(int x);.

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

Sidebar

Related Questions

Possible Duplicate: Why is it an error to use an empty set of brackets
Possible Duplicate: Why is it an error to use an empty set of brackets
Possible Duplicate: Weird “406 not acceptable” error following code generate a 406 Not Acceptable
Possible Duplicates: constructor invocation mechanism Why is it an error to use an empty
Possible Duplicate: How can I use C++ code to interact with PHP? I have
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: How can I use the Google App engine bulkloader to back up
Possible Duplicate: g++ “is not a type” error The following does not compile: 1
Possible Duplicate: How do I use arrays in C++? I am not sure if
Possible Duplicate: Testing use of NSURLConnection with HTTP response error statuses This is bizarre;

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.