Boost logo

Boost Users :

Subject: Re: [Boost-users] Using boost with explicit template instance
From: Nat Goodspeed (nat_at_[hidden])
Date: 2011-10-11 07:29:06


On Oct 10, 2011, at 10:24 PM, ranadheer p <p_ranadheer_at_[hidden]> wrote:

> We have built a C++ library using Boost and when we try to integrate the library in a binary we are having problem in linking because of “--instances=explicit” option used for building the binary.

There's an old joke in which a patient complains to his doctor: "Doctor, it hurts when I move my arm like this."

The doctor replies succinctly: "Then don't move your arm like that."

May I ask why you want to enforce explicit template instantiation? Much of Boost consists of metaprogramming, "template magic," in which the compiler is able to perform some pretty amazing feats because of implicit template instantiation. If you were required to research all the internal templates implicitly used by your code and hand-code correct instantiations, I assume it would be easier to hand-code all your functionality in the first place, avoiding Boost. I've never even heard of that switch; I fail to appreciate what you would gain by using it. My advice would be to turn it off and happily use Boost, saving yourself months (if not years) of reinventing equivalent functionality.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net