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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:59:53+00:00 2026-05-23T23:59:53+00:00

I have the following and having difficulty resolving the error please help. i have

  • 0

I have the following and having difficulty resolving the error please help.

i have the following class as template definition somewhere.

template<class ConcreteHandlerType>
class SomeAcceptor: public ACE_Acceptor<ConcreteHandlerType, ACE_SOCK_Acceptor>

In some other file, i initialize this class in the constructor

class initialize {

    typedef SomeAcceptor<BaseClassSomeHandler> baseAcceptor_t;
    typedef SomeAcceptor<DerivedClassSomeHandler> derivedAcceptor_t;
    boost::shared_ptr<baseAcceptor_t;> mAcceptor;   
    boost::shared_ptr<derivedAcceptor_t;> mDerivedAcceptor;   

    bool HandleAcceptNotification(BaseClassSomeHandler& someHandler);

    initialize() : mAcceptor(0), mDerivedAcceptor(new DerivedAcceptor_t) {
        mAcceptor->SetAcceptNotificationDelegate(fastdelegate::MakeDelegate(this, &initialize::HandleAcceptNotification));
    }
}

Error i get is

error: no matching function for call to `boost::shared_ptr<SomeAcceptor<BaseClassSomeHandler> >::shared_ptr(int)'common/lib/boost_1_39_0/boost/smart_ptr/shared_ptr.hpp:160: note: candidates are: boost::shared_ptr<SomeAcceptor<BaseClassSomeHandler> >::shared_ptr(const boost::shared_ptr<SomeAcceptor<BaseClassSomeHandler> >&)
common/lib/boost_1_39_0/boost/smart_ptr/shared_ptr.hpp:173: notboost::shared_ptr<T>::shared_ptr() [with T = SomeAcceptor<BaseClassSomeHandler>]

I also tried overloading the function with
bool HandleAcceptNotification(DerivedClassSomeHandler& someHandler);

but because mAcceptor is of type SomeAcceptor BaseClassSomeHandler, i get this error, but to fix this.

I guess i need to cast it somehow, but how to do it?

i tried doing like below inside the constructor and it didn’t work

    initialize() : mAcceptor(0), mDerivedAcceptor(new DerivedAcceptor_t) {

        mAcceptor = mDerivedAcceptor;   // Error here

        mAcceptor->SetAcceptNotificationDelegate(fastdelegate::MakeDelegate(this, &initialize::HandleAcceptNotification));
    }
  • 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-23T23:59:54+00:00Added an answer on May 23, 2026 at 11:59 pm

    From your code, it looks like you want mAcceptor to be assigned NULL (0), if that is the case you don’t need to initialize it at all, as the default constructor will take care of that. But, since you call a function on that (NULL) pointer immediately, its not immediately clear exactly what you want to do.

    If you want mAcceptor and mDerivedAcceptor to point to the same (shared) object and assuming DerivedClassSomeHandler is derived from BaseClassSomeHandler, this is a situation where you should use boost::shared_static_cast, as described here.

    There’s also some good information in this apparently related question.

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

Sidebar

Related Questions

I have the following web config file. I am having some difficulty in retrieving
I'm having difficulty working out how to 'error handle' as such the following SQL.
I am having some difficulty figuring out how to template the following TreeView item
I have the following bit of code that I am having some difficulty with.
I have the following application which replicates an issue I'm having in a larger
I am having following issue with reading binary file in C. I have read
I have the following query: select column_name, count(column_name) from table group by column_name having
I have the following code: SELECT <column>, count(*) FROM <table> GROUP BY <column> HAVING
We are having an annoying issue with Firefox and cookies. We have the following
I'm having an issue with rails involving javascript. Basically, I have the following code:

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.