Top new questions this week:
|
|
Suppose we have a string
std::string str; // some value is assigned
What is the difference between str.empty() and str[0] == '\0'?
|
|
How can *i and u.i print different numbers in this code, even though i is defined as int *i = &u.i;? I can only assuming that I'm triggering UB here, but I can't see how exactly.
(ideone demo ...
|
|
I currently write a set of doubles from a vector to a text file like this:
std::ofstream fout;
fout.open("vector.txt");
for (l = 0; l < vector.size(); l++)
fout << std::setprecision(10) ...
|
|
I am asking this question for two different languages: C and C++.
What is best practice when calling functions that have an opposite integer sign expectation to what we require in our code?
For ...
|
|
Disclaimer: No, I didn't find any obvious answer, contrary to what I expected!
When looking for code examples wrt. the arithmetic mean, the first several examples I can turn up via Google seem to be ...
|
|
Can we restrict variadic template arguments to a certain type? I.e., achieve something like this (not real C++ of course):
struct X {};
auto foo(X... args)
Here my intention is to have a function ...
|
|
In other words, why does this compile fine :
template<typename Type>
class A{
public:
void f();
};
class B{
friend void A<int>::f();
};
template<>
void A<int>::f(){
...
|
Greatest hits from previous weeks:
|
|
I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories.
Instead, I want to use the simplest way to rename a local branch, which hasn't ...
|
|
Is it possible to set up a basic HTML page to redirect to another page on load?
|
Can you answer these?
|
|
I have a issue that Proguard is not working when you declare a anonymous class within a anonymous class. This is what it looks like in a basic example:
public class Class1 {
public void function1 ...
|
|
I am using a Raspberry Pi 3 B model with a Grove Pi+ (1.2.2 firmware), and Raspbian for Robots Image.
I have plugged in the CO2 MH-Z16 sensor in RPISER port, and I am trying
to execute the code that ...
|
|
class A { int a; };
template<typename, typename = void>
class test {};
template<typename T>
class test<T,decltype(T::a)> {};
int main() { test<A> a; }
The code above ...
|