|
Boost : |
From: ÐмиÑÑий ÐÑÑ
ипов (grisumbras_at_[hidden])
Date: 2023-11-26 17:08:18
I have also posted review announcements on Reddit and in Cpplang Slack
workspace. Here are some comments I've received:
1. Given
void f();
int main()
{
auto a = boost::scope::make_scope_fail(f);
boost::scope::scope_fail b(f);
}
Only the declaration of b compiles. The one of a fails. I think the
one of a should compile, too. Something like std::decay instead of
typename std::remove_cv< typename std::remove_reference< F >::type
>::type at https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_exit.hpp#L535
2. According to http://eel.is/c++draft/lex.name#3.2, identifiers like
_foo are rerversed at global namespace. The macro BOOST_SCOPE_FINAL
(https://github.com/Lastique/scope/blob/develop/include/boost/scope/scope_final.hpp#L174)
expands to something beginning with _boost_scope_final_. I don't think
that anyone would ever use BOOST_SCOPE_FINAL at global namespace, but
if they would, this would be a violation of lex.name#3.2
3. unique_resource seems interesting, one thing that might be missing
from this kind of scope based resource management would be a
shared_resource. In OpenCL, resources are internally reference
counted, and have the following functions
clCreate* which returns a new resource (eg clCreateBuffer)
clRetain* which increments an internal reference counter (eg clRetainMemObject)
clRelease* which decrements the internal reference counter (eg
clReleaseMemObject)
The following types meet this format: cl_mem, cl_event, cl_sampler,
cl_context, cl_command_queue, cl_device, and probably a few others.
Its fairly straightforward to crack these into a general type that
implements shared RAII semantics on top of these. Notably there's no
(sane) way to ever query the reference count of an object
пÑ, 24 ноÑб. 2023â¯Ð³. в 23:58, ÐмиÑÑий ÐÑÑ
ипов <grisumbras_at_[hidden]>:
>
> Dear Boost community. The peer review of the proposed Boost.Scope will start on
> 26th of November and continue until December 5th. Boost.Scope is a small
> library implementing utilities defined in
> <experimental/scope> from C++ Extensions for Library Fundamentals v3
> with a few extensions. Namely, the library contains:
> * A number of scope guards for various use cases.
> * A unique resource wrapper that automatically frees the resource on
> destruction.
> * Utilities for wrapping POSIX-like file descriptors in the unique
> resource wrapper.
>
> You can find the source code of the library at
> https://github.com/Lastique/scope and read the documentation at
> https://lastique.github.io/scope/libs/scope/doc/html/index.html. The library
> is header-only and thus it is fairly easy to try it out. In addition, the
> library can be used with Conan and vcpkg (see its README for instructions on
> how to do that). Finally, there's a single header version suitable for Compiler
> Explorer (https://raw.githubusercontent.com/Lastique/scope/single-header/include/boost/scope.hpp).
>
> As the library is not domain-specific, everyone is very welcome to contribute a
> review either by sending it to the Boost mailing list, or me personally. In
> your review please state whether you recommend to reject or accept the library
> into Boost, and whether you suggest any conditions for acceptance.
>
> Thanks in advance for your time and effort!
>
> Dmitry Arkhipov, Staff Engineer at The C++ Alliance.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk