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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:37:42+00:00 2026-05-24T06:37:42+00:00

I am getting compilation error with g++4.6 and boost 1.42 when using boost::make_shared<T>(…) ,

  • 0

I am getting compilation error with g++4.6 and boost 1.42 when using boost::make_shared<T>(...), whereas shared_ptr<T>(new T(...)) compiles just fine. I am unfortunately not able to isolate a minimal example (anything I tried compiled just fine for both), but perhaps someone could explain to me the difference.

I am instatiating an instance of shared_ptr<ResidualsFunctor> f, where ResidualsFunctor has the following ctor:

ResidualsFunctor(int,int,StaticEquilibriumSolver*)

This

f=shared_ptr<ResidualsFunctor>(new ResidualsFunctor(0,0,this)); // this is a StaticEquilibriumSolver*

compiles just fine, whereas

f=make_shared<ResidualsFunctor>(0,0,this); 

tells me:

/usr/include/boost/smart_ptr/make_shared.hpp: In function 'boost::shared_ptr<T> boost::make_shared(Args&& ...) [with T = StaticEquilibriumSolver::ResidualsFunctor, Args = int, int, StaticEquilibriumSolver* const]':
pkg/sparc/SparcField.cpp:472:49:   instantiated from here
/usr/include/boost/smart_ptr/make_shared.hpp:148:5: error: no matching function for call to 'forward(int&)'
/usr/include/boost/smart_ptr/make_shared.hpp:148:5: note: candidate is:
/usr/include/boost/smart_ptr/make_shared.hpp:90:40: note: template<class T> T&& boost::detail::forward(T&&)

Is it a bug in boost? In gcc? My fault which I don’t see?

  • 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-24T06:37:43+00:00Added an answer on May 24, 2026 at 6:37 am

    boost::make_shared allocates an object of the given type, using the given parameters and wraps it in a boost::shared_ptr. Therefore, it has to forward the arguments you give it to a constructor. In order for your call to it to work, it must be able to find a constructor that matches the argument list you give it.

    Your problem seems to be that it is having difficulty forwarding your integer arguments. I’m not sure how, as all of your arguments are basic types.

    Boost 1.42 was released 18 months ago; GCC 4.6 was released rather more recently than that. I’d guess that if you update to a more recent version of Boost, you wouldn’t have this problem.

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

Sidebar

Related Questions

I keep getting compilation error for a kernel module: XXX: In function 'yyy': ZZZ:125:
Normally someone would just go and grab Boost's Function Output Iterator but I'm not
I'm getting the following error on my site; Microsoft VBScript compilation error '800a03f2' Expected
All time am getting below error message in groovy... Could not understand whats causing
I am getting compilation error in below code. class A { public: A() {
I am getting a weird compilation error - I dont know if there is
Just getting my head around Ruby metaprogramming. The mixin/modules always manage to confuse me.
I getting the following error when I try to connect to my server app
Just getting started with Linq to SQL so forgive the newbie question. I'm trying
I am getting to know boost::variant. I think this example should work. #include <boost/fusion/sequence.hpp>

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.