Skip to content

Commit

Permalink
Removed support for boost::shared_ptr, boost::weak_ptr, boost::function
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Dec 4, 2021
1 parent f775440 commit 0e4e5b3
Show file tree
Hide file tree
Showing 48 changed files with 561 additions and 646 deletions.
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@
"command": "${workspaceRoot}/.vscode/msvc.bat && cd ${workspaceRoot}/bld/debug && meson test"
}
},
{
"group": "test",
"label": "Run all unit tests (b2, all configurations)",
"type": "shell",
"command": "../../b2 test link=shared,static variant=debug,release exception-handling=on,off cxxstd=11,14,1z,17",
"problemMatcher": {
"base": "$gcc",
"fileLocation": [
"relative",
"${workspaceRoot}/bld/release"
]
}
},
{
"group": {
"kind": "test",
Expand Down
51 changes: 0 additions & 51 deletions build/test/Jamfile.v2

This file was deleted.

4 changes: 0 additions & 4 deletions doc/synapse.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1361,10 +1361,6 @@ Because Synapse is formatted for Boost review, people often ask what are the dif

== Macros and Configuration

=== `BOOST_SYNAPSE_USE_BOOST`

If this macro is defined, Synapse will use `boost::shared_ptr`, `boost::weak_ptr` and `boost::function`. By default, it will use `std::shared_ptr`, `std::weak_ptr` and `std::function`.

=== `BOOST_SYNAPSE_ASSERT`

All assertions in Synapse use this macro. If it is not defined, Synapse header files `#define` it either as `BOOST_ASSERT` or `assert`, depending on whether `BOOST_SYNAPSE_USE_BOOST` is defined.
Expand Down
2 changes: 1 addition & 1 deletion example/glfw/glfw_synapsify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class synapsifier<R(*)(GLFWwindow *,A...)>
// (when the connection expires). The emitter pointer passed to connect
// (which in this case is of type GLFWwindow) is stored in the
// synapse::connection object passed to the lambda below, and can be
// accessed by the connection::emitter member function template.
// accessed by the connection::emitter member std::function template.
connect<meta::connected<Signal> >( meta::emitter(),
[setter]( connection & c, unsigned flags )
{
Expand Down
20 changes: 12 additions & 8 deletions include/boost/synapse/block.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ namespace boost { namespace synapse {
class blocker;

template <class Signal, class Emitter>
shared_ptr<blocker> block( Emitter * );
std::shared_ptr<blocker> block( Emitter * );

template <class Signal, class Emitter>
shared_ptr<blocker> block( weak_ptr<Emitter> const & );
std::shared_ptr<blocker> block( std::weak_ptr<Emitter> const & );

template <class Signal, class Emitter>
shared_ptr<blocker> block( shared_ptr<Emitter> const & );
std::shared_ptr<blocker> block( std::shared_ptr<Emitter> const & );

namespace meta
{
Expand All @@ -49,34 +49,38 @@ namespace boost { namespace synapse {

namespace synapse_detail
{
shared_ptr<blocker> block_( shared_ptr<thread_local_signal_data> const &, weak_store &&, int(*)(blocker &,bool) );
std::shared_ptr<blocker> block_( std::shared_ptr<thread_local_signal_data> const &, weak_store &&, int(*)(blocker &,bool) );
template <class Signal> int emit_meta_blocked( blocker &, bool );

template <class Signal, class Emitter>
shared_ptr<blocker> block_fwd( weak_store && e )
std::shared_ptr<blocker> block_fwd( weak_store && e )
{
return block_(get_thread_local_signal_data<Signal>(true),std::move(e),&emit_meta_blocked<Signal>);
}
}

template <class Signal, class Emitter>
shared_ptr<blocker> block( Emitter * e )
std::shared_ptr<blocker> block( Emitter * e )
{
return synapse_detail::block_fwd<Signal,Emitter>(e);
}

template <class Signal, class Emitter>
shared_ptr<blocker> block( weak_ptr<Emitter> const & e )
std::shared_ptr<blocker> block( std::weak_ptr<Emitter> const & e )
{
return synapse_detail::block_fwd<Signal,Emitter>(e);
}

template <class Signal, class Emitter>
shared_ptr<blocker> block( shared_ptr<Emitter> const & e )
std::shared_ptr<blocker> block( std::shared_ptr<Emitter> const & e )
{
return synapse_detail::block_fwd<Signal,Emitter>(e);
}

} }

#if defined(_MSC_VER) && !defined(BOOST_SYNAPSE_ENABLE_WARNINGS)
# pragma warning(pop)
#endif

#endif
8 changes: 6 additions & 2 deletions include/boost/synapse/blocker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace boost { namespace synapse {

public:

template <class T> shared_ptr<T> emitter() const;
template <class T> std::shared_ptr<T> emitter() const;
};

} }
Expand All @@ -42,11 +42,15 @@ namespace boost { namespace synapse {
namespace boost { namespace synapse {

template <class T>
shared_ptr<T> blocker::emitter() const
std::shared_ptr<T> blocker::emitter() const
{
return emitter_().maybe_lock<T>();
}

} }

#if defined(_MSC_VER) && !defined(BOOST_SYNAPSE_ENABLE_WARNINGS)
# pragma warning(pop)
#endif

#endif
Loading

0 comments on commit 0e4e5b3

Please sign in to comment.