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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:25:25+00:00 2026-05-26T07:25:25+00:00

I have a class constructor like so: DotDashLogMatcher( std::stringstream const& pattern ); I call

  • 0

I have a class constructor like so:

DotDashLogMatcher( std::stringstream const& pattern );

I call it like so:

std::stringstream s;
DotDashLogMatcher( s << "test" );

This is an over-simplified example, but that is essentially what is going on. Here is the exact compiler error I’m getting. Note that for some reason the resulting object that is passed in is a basic_ostream, I am not sure if this is normal. It isn’t able to cast it to an std::stringstream like my function expects.

error C2664: 'DotDashLogMatcher::DotDashLogMatcher(const stlpd_std::stringstream &)' : cannot convert parameter 1 from 'stlpd_std::basic_ostream<_CharT,_Traits>' to 'const stlpd_std::stringstream &'
        with
        [
            _CharT=char,
            _Traits=stlpd_std::char_traits<char>
        ]
        Reason: cannot convert from 'stlpd_std::basic_ostream<_CharT,_Traits>' to 'const stlpd_std::stringstream'
        with
        [
            _CharT=char,
            _Traits=stlpd_std::char_traits<char>
        ]
        No constructor could take the source type, or constructor overload resolution was ambiguous

I’m using VS2003 and STLport on Windows.

Anyone know where I’m going wrong here? Why won’t this code compile? I apologize in advance if I am lacking information. I will update my question for those that request more info.

  • 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-26T07:25:25+00:00Added an answer on May 26, 2026 at 7:25 am

    operator<< does not return a std::stringstream because it is inherited from std::ostream. See:

    http://www.cplusplus.com/reference/iostream/stringstream/

    You may use:

    DotDashLogMatcher( s );

    Or you may change your method declaration in order to match the return type.

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

Sidebar

Related Questions

I have a varargs constructor like this : public class Sentence { public String[]
I have a class whose constructor takes a const reference to a string. This
So, I have a class with a constructor like this: public FilterList(Set<Integer> labels) {
I have a class with the only constructor like this: IntroScreen::IntroScreen(Game *game) : View(game),
Example: I have a class called ParentClass. ParentClass has a constructor like this: function
I have class with member functions: typedef std::function<bool (const std::string &)> InsertFunction; bool insertSourceFile(
I have a class with a constructor that looks like this: public TimedWorker(int timerInterval,
I have a class with two constructors that look like this: public MyClass(SomeOtherClass source)
I have two classes, Foo and Bar, that have constructors like this: class Foo
I have a constructor question for C#. I have this class: public partial class

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.