mirror of
https://github.com/topjohnwu/cxx.git
synced 2024-11-24 04:20:02 +00:00
AlwaysBreakTemplateDeclarations: true
I felt that the clangfmt changes in c2279000a9
were not making the code better.
This commit is contained in:
parent
c2279000a9
commit
f262d38671
1
.clang-format
Normal file
1
.clang-format
Normal file
@ -0,0 +1 @@
|
||||
AlwaysBreakTemplateDeclarations: true
|
@ -85,7 +85,8 @@ private:
|
||||
|
||||
#ifndef CXXBRIDGE02_RUST_BOX
|
||||
#define CXXBRIDGE02_RUST_BOX
|
||||
template <typename T> class Box final {
|
||||
template <typename T>
|
||||
class Box final {
|
||||
public:
|
||||
using value_type = T;
|
||||
using const_pointer = typename std::add_pointer<
|
||||
@ -132,7 +133,8 @@ public:
|
||||
T *operator->() noexcept { return this->ptr; }
|
||||
T &operator*() noexcept { return *this->ptr; }
|
||||
|
||||
template <typename... Fields> static Box in_place(Fields &&... fields) {
|
||||
template <typename... Fields>
|
||||
static Box in_place(Fields &&... fields) {
|
||||
Box box;
|
||||
box.uninit();
|
||||
::new (box.ptr) T{std::forward<Fields>(fields)...};
|
||||
@ -163,7 +165,8 @@ private:
|
||||
|
||||
#ifndef CXXBRIDGE02_RUST_FN
|
||||
#define CXXBRIDGE02_RUST_FN
|
||||
template <typename Signature, bool Throws = false> class Fn;
|
||||
template <typename Signature, bool Throws = false>
|
||||
class Fn;
|
||||
|
||||
template <typename Ret, typename... Args, bool Throws>
|
||||
class Fn<Ret(Args...), Throws> {
|
||||
@ -176,7 +179,8 @@ private:
|
||||
void *fn;
|
||||
};
|
||||
|
||||
template <typename Signature> using TryFn = Fn<Signature, true>;
|
||||
template <typename Signature>
|
||||
using TryFn = Fn<Signature, true>;
|
||||
#endif // CXXBRIDGE02_RUST_FN
|
||||
|
||||
#ifndef CXXBRIDGE02_RUST_ERROR
|
||||
@ -209,11 +213,13 @@ std::ostream &operator<<(std::ostream &, const Str &);
|
||||
// Snake case aliases for use in code that uses this style for type names.
|
||||
using string = String;
|
||||
using str = Str;
|
||||
template <class T> using box = Box<T>;
|
||||
template <class T>
|
||||
using box = Box<T>;
|
||||
using error = Error;
|
||||
template <typename Signature, bool Throws = false>
|
||||
using fn = Fn<Signature, Throws>;
|
||||
template <typename Signature> using try_fn = TryFn<Signature>;
|
||||
template <typename Signature>
|
||||
using try_fn = TryFn<Signature>;
|
||||
|
||||
#ifndef CXXBRIDGE02_RUST_BITCOPY
|
||||
#define CXXBRIDGE02_RUST_BITCOPY
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
template <typename Exception> static void panic [[noreturn]] (const char *msg) {
|
||||
template <typename Exception>
|
||||
static void panic [[noreturn]] (const char *msg) {
|
||||
#if defined(RUST_CXX_NO_EXCEPTIONS)
|
||||
std::cerr << "Error: " << msg << ". Aborting." << std::endl;
|
||||
std::terminate();
|
||||
|
Loading…
Reference in New Issue
Block a user