clang-format
This commit is contained in:
@@ -19,18 +19,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <pthread.h>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
#include <pthread.h>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
template<typename... Args>
|
||||
std::thread named_thread(const std::string& name, Args&&... args)
|
||||
template <typename... Args>
|
||||
std::thread named_thread(const std::string & name, Args &&... args)
|
||||
{
|
||||
std::thread t{std::forward<Args>(args)...};
|
||||
pthread_setname_np(t.native_handle(), name.substr(0, 15).c_str());
|
||||
return t;
|
||||
}
|
||||
}
|
||||
} // namespace utils
|
||||
|
||||
@@ -56,7 +56,6 @@ public:
|
||||
read_index.store(next_read);
|
||||
return std::move(res);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace utils
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
class singleton
|
||||
{
|
||||
// static_assert(std::derived_from<T, singleton<T>>);
|
||||
@@ -32,7 +32,7 @@ protected:
|
||||
singleton()
|
||||
{
|
||||
assert(instance_ == nullptr);
|
||||
instance_ = reinterpret_cast<T*>(this);
|
||||
instance_ = reinterpret_cast<T *>(this);
|
||||
}
|
||||
|
||||
~singleton()
|
||||
@@ -41,15 +41,16 @@ protected:
|
||||
instance_ = nullptr;
|
||||
}
|
||||
|
||||
singleton(const singleton&) = delete;
|
||||
singleton& operator=(const singleton&) = delete;
|
||||
singleton(const singleton &) = delete;
|
||||
singleton & operator=(const singleton &) = delete;
|
||||
|
||||
public:
|
||||
static T & instance()
|
||||
{
|
||||
assert(instance_ != nullptr);
|
||||
return *reinterpret_cast<T*>(instance_);
|
||||
return *reinterpret_cast<T *>(instance_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> T * singleton<T>::instance_;
|
||||
template <typename T>
|
||||
T * singleton<T>::instance_;
|
||||
|
||||
@@ -57,13 +57,13 @@ public:
|
||||
auto userdata_first()
|
||||
{
|
||||
using F = decltype(std::function(impl));
|
||||
return details::add_void<F>::template fn_0<T>;
|
||||
return ::details::add_void<F>::template fn_0<T>;
|
||||
}
|
||||
|
||||
operator auto()
|
||||
{
|
||||
using F = decltype(std::function(impl));
|
||||
return details::add_void<F>::template fn<T>;
|
||||
return ::details::add_void<F>::template fn<T>;
|
||||
}
|
||||
|
||||
operator void *()
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <filesystem>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
|
||||
std::filesystem::path xdg_config_home()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user