Questions tagged [struct]
The struct tag has no summary.
8 questions
0
votes
1
answer
150
views
Generalised indexing scheme for variable memory layouts
structs are great, the only problem is that not only do they associate data (topo)logically, they also crystallise a memory layout for that set of concepts. I would like to avoid the latter.
So I'm ...
27
votes
9
answers
9k
views
Is it a security vulnerability to declare class members as public?
I have always wondered whether public, protected, and private has security implications post compilation.
Hypothetically:
class Foo
{
public:
int m_Foo; // Completely vulnerable and dangerous
...
5
votes
3
answers
2k
views
Struct or class for wrapping an int when 0 isn't a valid value
I have a business object which is basically a wrapper around a value of type int. There are some constraints for the value/object:
Not every value in int's range is valid1
The valid values are not a ...
7
votes
0
answers
427
views
Rust and lifetime elision rules for structs?
In the Rust documentation, under the structs section, they give this example of how structs need lifetimes when they contain references:
struct Foo<'a> {
x: &'a i32,
}
because
We need ...