Boost logo

Boost :

From: Ivan Matek (libbooze_at_[hidden])
Date: 2025-05-02 01:05:16


On Fri, May 2, 2025 at 2:10 AM Jean-Louis Leroy via Boost <
boost_at_[hidden]> wrote:

> Maybe Joaquín wants to jump in, I don't want to put words in his mouth ;-)
>

Would be nice, from what I got from his talk some performance I have seen
in my experiments, e.g. finding perfect hash for 368 items in 512 buckets
seems almost impossible when we apply formula from the talk.

> > 2. regarding static_list: would Boost.Intrusive list work here also, and
> if so
> > was this considered?
>
> Yes. static_list needs to work in a special context: static construction
> time.I.e., no guaranteed construction order across translation units. Its
> default constructor does nothing. It relies on zero-initialization.
>
> I remember that Boost.Intrusive lists had customization points, but not
> what I
> needed. Unless I missed something...
>

I see, thank you for explaining. If somebody knows more about
Boost.Intrusive maybe they can provide more details.

>
> > 3. basic_error_output does not seem to need the Policy template
> parameter, is
> > this left for consistency or am I wrong that it is not needed?
>
> It is needed because it has static state:
>
> template<class Policy, typename Stream = detail::ostderr>
> struct basic_error_output : virtual error_output {
> static Stream error_stream;
> };
>
> My policy's error_stream is not your policy's error_stream ;-)
>

So this is to enable for example my_policy1 to log to cerr, while
my_policy2 logs to file?

>
> Enforce the contract at the source. Good suggestion though...

Thank you for adding https://github.com/jll63/Boost.OpenMethod/issues/4
I presume it will be easier for people to follow review, although this is a
tiny item.

One more question: why not use inline variable here, afaik they are C++17
so it should work.

namespace boost::openmethod::policies {

template<class Policy, typename Stream = detail::ostderr>
struct basic_error_output : virtual error_output {
    static Stream error_stream;
};

template<class Policy, typename Stream>
Stream basic_error_output<Policy, Stream>::error_stream;

} // namespace boost::openmethod::policies


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk