Boost logo

Boost :

Subject: Re: [boost] [Stacktrace] Second review begins today 17th Mar ends 26th Mar
From: Peter Dimov (lists_at_[hidden])
Date: 2017-03-18 11:11:16


Antony Polukhin via Boost wrote:
> > template <class E>
> > void throw_with_trace(const E& e) {
> > throw boost::enable_error_info(e)
> > << traced(boost::stacktrace::stacktrace());
> > }
> >
> > Here no COM or <windows.h> code is needed, but there's no way to avoid
> > their inclusion.
>
> How it could be done?

By splitting stacktrace.hpp and frame.hpp into two headers, one with the
parts that do not need <windows.h>, the other with the rest. The code above
would then be able to only include the first header. Picking some names at
random,

stacktrace.hpp
    stacktrace_def.hpp
    stacktrace_impl.hpp

frame.hpp
    frame_def.hpp
    frame_impl.hpp

stacktrace_def.hpp
    frame_def.hpp

stacktrace_impl.hpp
    frame_impl.hpp

although currently stacktrace has no impl parts, so it could be simplified
to

stacktrace.hpp
    stacktrace_def.hpp
    frame_impl.hpp

stacktrace_def.hpp
    frame_def.hpp

frame.hpp
    frame_def.hpp
    frame_impl.hpp

> std::thread has no constructor from std::thread::native_handle_t and I'd
> like to follow that pattern. If you've done something using
platform specific methods - you're on your own.

This makes no sense to me, especially since frame is constructible from void
const*. stacktrace is just an array of frames.


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