Boost logo

Boost Users :

Subject: Re: [Boost-users] [flyweights] private constructor, friend access
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2015-05-14 21:03:47


 <r <at> primef.actor> writes:

>
> Dear all,
>
> On a project of mine, I started to use Boost.Flyweight. I would like
> users of my class to only be able to instantiate objects of my class by
> using the Boost.Flyweight mechanism. For this, I make my class
> constructor private. However, when doing so the corresponding flyweight
> factory also cannot instantiate my class. What classes do I need to
> `friend` in order to make this work?

You need to do

     template<typename,typename,typename>
     friend struct boost::flyweights::detail::optimized_key_value;

but this is highly unadvisable, as you're relying on undocumented
classes that might change without prior notice in future versions
of the library. An alternative is to simply make the whole±…ÍÌ)¥µÁ±•µ•¹Ñ…Ñ¥½¸ÁÉ¥Ù…Ñ”è((€€€±…Í́`ì(€€€€€€€ÍÑÉՍЁ¥µÁ°(€€€€€€€ì(€€€€€€€€€€€¥µÁ°¡¥¹Ðà¤éµ}‘…Ñ„¡à¥íô쀀€€€€€€(€€€€€€€€€€€¥¹Ð‘…Ñ„ ¤½¹ÍЁìÉ•ÑÕɸµ}‘…Ñ„ìô(€€€€€€€€€€€¥¹Ðµ}‘…Ñ„ì(€€€€€€€ôì(€€€€€€€€(€€€€€€€ÍÑÉՍЁ­•å}•áÑÉ…Ñ½È(€€€€€€€ì(€€€€€€€€€€€¥¹Ð½Á•É…ѽȠ¤¡½¹ÍЁ¥µÁ°˜à¤½¹ÍЁìÉ•ÑÕɸà¹‘…Ñ„ ¤ìô(€€€€€€€ôì(€€€€(€€€ÁÕ‰±¥Œè(€€€€€€€ÑåÁ•‘•˜‰½½ÍÐèé™±åÝ•¥¡ÑÌèé™±åÝ•¥¡Ðð(€€€€€€€€€€€‰½½ÍÐèé™±åÝ•¥¡ÑÌèé­•å}Ù…±Õ”ð(€€€€€€€€€€€€€€€¥¹Ð°(€€€€€€€€€€€€€€€¥µÁ°°(€€€€€€€€€€€€€€€­•å}•áÑÉ…Ñ½È(€€€€€€€€€€€€ø(€€€€€€€€ø™±åÝ•¥¡Ðì(€€€ôì(€€€€(€€€¥¹Ðµ…¥¸ ¤(€€€ì(€€€€€€€…ÕѼµå}à€ô`èé™±åÝ•¥¡Ð ÐȤì(€€€€€€€É•ÑÕɸ€Àì(€€€ô())½…Å×µ¸43ÍÁ•è5׎è)Q•±•›͹¥„


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