.release()
doesn't destroy the pointer, it's more like getting the raw pointer out of the unique pointer and forgetting that it was a unique_ptr
(and not calling its destructor)const
and constexpr
variable definitions when using the readability-identifier-naming
checksconstexpr
variable definition to be named like a macro, in UPPER_CASE
but i want const
variable definitions (which i only use over constexpr when it's not a compile-time evaluable expression) to be named like normal variables (CamelCase
) (edited)readability-identifier-naming
doesn't consider is lambdas /// Return the dialect registry associated with this context.
const DialectRegistry &getDialectRegistry();
const DialectRegistry &getDialectRegistry() const;
const DialectRegistry &MLIRContext::getDialectRegistry() {
return impl->dialectsRegistry;
}
x_ninja
.
I hope there can be some new settings, as same as cl_nameplates_friendmark
, called cl_nameplates_playermark
and cl_nameplates_dummymark
.
Thx!
~By the way, is there no issue template here?~cargo clean
in my bigger projects to gain back 10GB of space which accumulates over timeamdvlk64.dll!vk_icdNegotiateLoaderICDInterfaceVersion+0x2f07a
SteamOverlayVulkanLayer64.dll!vkGetSwapchainImagesKHR+0x42e
graphics-hook64.dll!dummy_debug_proc+0x86c7
vulkan-1.dll!vkDestroyDescriptorPool+0x47d1d
amdvlk64.dll!vk_icdNegotiateLoaderICDInterfaceVersion+0x2f07a
SteamOverlayVulkanLayer64.dll!vkGetSwapchainImagesKHR+0x42e
graphics-hook64.dll!dummy_debug_proc+0x86c7
vulkan-1.dll!vkDestroyDescriptorPool+0x47d1d
amdvlk64.dll!vk_icdNegotiateLoaderICDInterfaceVersion+0x2f07a
SteamOverlayVulkanLayer64.dll!vkGetSwapchainImagesKHR+0x42e
graphics-hook64.dll!dummy_debug_proc+0x86c7
vulkan-1.dll!vkDestroyDescriptorPool+0x47d1d
const DialectRegistry &getDialectRegistry();
fn getDialectRegistry() -> &DialectRegistry
pub struct DialectRegistry {
pub(crate) ptr: UniquePtr<ffi::DialectRegistry>,
}
pub struct DialectRegistry {
pub(crate) ptr: UniquePtr<ffi::DialectRegistry>,
}
UniquePtr<DialectRegistry>
and &DialectRegistry
to the callerDialectRegistry
, it should work with UniquePtr<DialectRegistry>
and &DialectRegistry
&self
methods, at least*mut
you mean?*mut
to UniquePtr
std::unique_ptr<MLIRContext> context_new()
{
return std::make_unique<MLIRContext>();
}
const DialectRegistry& context_get_dialect_registry(const MLIRContext &context)
{
auto& reg = const_cast<MLIRContext &>(context).getDialectRegistry();
return reg;
}
std::unique_ptr<DialectRegistry> dialect_registry_new()
{
return std::make_unique<DialectRegistry>();
}
std::unique_ptr<MLIRContext> context_new()
{
return std::make_unique<MLIRContext>();
}
const DialectRegistry& context_get_dialect_registry(const MLIRContext &context)
{
auto& reg = const_cast<MLIRContext &>(context).getDialectRegistry();
return reg;
}
std::unique_ptr<DialectRegistry> dialect_registry_new()
{
return std::make_unique<DialectRegistry>();
}
UniquePtr
and &
const this
? /// Return the dialect registry associated with this context.
const DialectRegistry &getDialectRegistry();
const auto &
this
const auto &
pub(crate) enum FFIPtr<'a, T>
where
T: UniquePtrTarget,
{
Owned(UniquePtr<T>),
Borrowed(&'a T),
}
impl<'a, T> FFIPtr<'a, T>
where
T: UniquePtrTarget,
{
pub fn pin_mut(&mut self) -> Pin<&mut T> {
match self {
FFIPtr::Owned(x) => x.pin_mut(),
FFIPtr::Borrowed(_) => todo!(),
}
}
}
impl<'a, T> AsRef<T> for FFIPtr<'a, T> where T: UniquePtrTarget {
fn as_ref(&self) -> &T {
match self {
FFIPtr::Owned(x) => x,
FFIPtr::Borrowed(x) => x,
}
}
}
Ctrl+c
is useless. Keep the last copy.pub(crate) enum FFIPtr<'a, T>
where
T: UniquePtrTarget,
{
Owned(UniquePtr<T>),
Borrowed(&'a T),
}
impl<'a, T> FFIPtr<'a, T>
where
T: UniquePtrTarget,
{
pub fn pin_mut(&mut self) -> Pin<&mut T> {
match self {
FFIPtr::Owned(x) => x.pin_mut(),
FFIPtr::Borrowed(_) => todo!(),
}
}
}
impl<'a, T> AsRef<T> for FFIPtr<'a, T> where T: UniquePtrTarget {
fn as_ref(&self) -> &T {
match self {
FFIPtr::Owned(x) => x,
FFIPtr::Borrowed(x) => x,
}
}
}
impl<'a, T> AsRef<T> for FFIPtr<'a, T> where T: UniquePtrTarget { // concept/constraint?
fn as_ref(&self) -> &T { // return type?
match self { // idk
FFIPtr::Owned(x) => x,
FFIPtr::Borrowed(x) => x,
}
}
}
(edited)'a
in the templateC:\Program Files
or whatever its default location is, cmake can't find ituse std::borrow::Cow
struct Items<'a, X: 'a> where [X]: ToOwned<Owned = Vec<X>> {
values: Cow<'a, [X]>,
}
impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned = Vec<X>> {
fn new(v: Cow<'a, [X]>) -> Self {
Items { values: v }
}
}
struct Closure<F> {
data: (u8, u16),
func: F,
}
impl<F> Closure<F>
where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8,
{
fn call(&self) -> &u8 {
(self.func)(&self.data)
}
}
fn do_it(data: &(u8, u16)) -> &u8 { &data.0 }
fn main() {
let clo = Closure { data: (0, 1), func: do_it };
println!("{}", clo.call());
}
impl<'a, T> AsRef<T> // define lifetime and to hold T as a reference
for FFIPtr<'a, T> // when (how is it accessed?)
where T: UniquePtrTarget { // trait bounds
fn as_ref(&self) -> &T { // return type
match self { // lookup self from FFIPtr enum, idk what it does with it
FFIPtr::Owned(x) => x,
FFIPtr::Borrowed(x) => x,
}
}
}
pub enum Result<T, E> {
Ok(T),
Err(E),
}
If you are using C or C++, it is probably because you have to -
/home/deen/isos/ddnet/
yaR0$
onlineyaR0$
come from then xdstd::stringstream ss;
ss << "Today is " << month << " " << day << ", " << year << " and it is " << hour << ":" << minute << ".";
is as efficient as
std::string str = std::format(
"Today is {} {}, {} and it is {}:{}.", month, day, year, hour, minute);
if x == 10 { expression; }
is booty cheeksmatch
fail on compile if it doesn't have a catch-all like y => {}
or _ => {}
or does it do something elsematch
fail on compile if it doesn't have a catch-all like y => {}
or _ => {}
or does it do something else {} => unreachable!()
, does it tell u about that?{} => unreachable!()
, does it tell u about that? ..
? or smth (edited)let x = 2;
match x {
e @ 1 ..= 5 => println!("got a range element {}", e),
_ => println!("anything"),
}
e @ 1 ..= 5
is so weird to me atmif let Person {name: ref person_name, age: 18..=150 } = value { }
if let Person {name: ref person_name, age: 18..=150 } = value { }
let x = 34isize;
let x = 34usize;
why not let x = 34i
/let x = 34u
std::float64_t
auto x = 32i64;
uint32_t
, it might have to waste memory or use inefficient instructions on a 64bit systemtypedef signed char int_fast8_t;
typedef long int int_fast16_t;
typedef long int int_fast32_t;
typedef long int int_fast64_t;
int
it's worse than what the compiler would do<<
is a separate callstd::ostringstream
fell behing sprintf
println!
is slower than python print
sprintln!
consistentlyprintf
consistently?\n
(edited)std::ostringstream
fell behing sprintf
printf("%s\n", string);
to puts(string);
snprintf(buf, sizeof(buf), "%d", integer);
to the fastest integer conversion routinestd::ostringstream
similarly fast by creating a format string internallySDL_scancode.h
which is used by gen_keys.py
to generate the list of keys enum (keys.h
) and the list of key names (keynames.h
) and regenerate the lists.
This adds support for 6 uncommonly used keys (audiorewind, audiofastforward, softleft, softright, call, endcall).