Related
Aria_JC I have the following function declaration: void get_data(struct myStruct* const value, const void * const data);
I have another function where I want to add a std::functionas a parameter: // I think the std::function definition is where my problem is
Roy My question/concern is about the function parameter to be used in std::transform(). In the following code, if I use "pass by reference" in the integer parameter of ithe square function (ie int squared(int i)), it doesn't compile). I had to change it to pas
innocent bystander Imagine the following simplified code: #include <iostream>
void foo(const int& x) { do_something_with(x); }
int main() { foo(42); return 0; }
(1) Besides optimization, what happens when 42 is passed to foo? Does the compiler stick 42 somew
innocent bystander Imagine the following simplified code: #include <iostream>
void foo(const int& x) { do_something_with(x); }
int main() { foo(42); return 0; }
(1) Besides optimization, what happens when 42 is passed to foo? Does the compiler stick 42 somew
innocent bystander Imagine the following simplified code: #include <iostream>
void foo(const int& x) { do_something_with(x); }
int main() { foo(42); return 0; }
(1) Besides optimization, what happens when 42 is passed to foo? Does the compiler stick 42 somew
innocent bystander Imagine the following simplified code: #include <iostream>
void foo(const int& x) { do_something_with(x); }
int main() { foo(42); return 0; }
(1) Besides optimization, what happens when 42 is passed to foo? Does the compiler stick 42 somew
innocent bystander Imagine the following simplified code: #include <iostream>
void foo(const int& x) { do_something_with(x); }
int main() { foo(42); return 0; }
(1) Besides optimization, what happens when 42 is passed to foo? Does the compiler stick 42 somew
Tomilov Anatoliy Wouldn't it be better to pass functional objects into STL algorithms by forwarding references rather than by value? It will allow to take advantage of the reference qualifier of operator ()the passed function object . There are several std::fo
Tomilov Anatoliy Wouldn't it be better to pass functional objects into STL algorithms by forwarding references rather than by value? It will allow to take advantage of the reference qualifier of operator ()the passed function object . There are several std::fo
Tomilov Anatoliy Wouldn't it be better to pass functional objects into STL algorithms by forwarding references rather than by value? It will allow to take advantage of the reference qualifier of operator ()the passed function object . There are several std::fo
Tomilov Anatoliy Wouldn't it be better to pass functional objects into STL algorithms by forwarding references rather than by value? It will allow to take advantage of the reference qualifier of operator ()the passed function object . There are several std::fo
Tomilov Anatoliy Wouldn't it be better to pass functional objects into STL algorithms by forwarding references rather than by value? It will allow to take advantage of the reference qualifier of operator ()the passed function object . There are several std::fo
Mendes I have an std::unique_ptr<T>object and a library function with T¶meters . This function will change the Tobject data. What is a better way to pass std::unique_ptr<T>to this function ? Is the above code correct? Is there a better way? #include <iostr
Dean Why does the following work? #include <iostream>
using namespace std;
class PolyLine {
public:
PolyLine() = default;
PolyLine(PolyLine * ptr) {
std::cout << "Ctor called" << std::endl;
}
};
void function(const PolyLine& pt) {
}
int main() {
DarkLite1 We're using the Vue Composition API and want to pass refobjects (not just values) as arguments to functions. Some code to clarify: import { defineComponent, ref } from '@vue/composition-api'
export default defineComponent({
setup() {
const dri
DarkLite1 We're using the Vue Composition API and want to pass refobjects (not just values) as arguments to functions. Some code to clarify: import { defineComponent, ref } from '@vue/composition-api'
export default defineComponent({
setup() {
const dri
DarkLite1 We're using the Vue Composition API and want to pass refobjects (not just values) as arguments to functions. Some code to clarify: import { defineComponent, ref } from '@vue/composition-api'
export default defineComponent({
setup() {
const dri
DarkLite1 We're using the Vue Composition API and want to pass refobjects (not just values) as arguments to functions. Some code to clarify: import { defineComponent, ref } from '@vue/composition-api'
export default defineComponent({
setup() {
const dri
DarkLite1 We're using the Vue Composition API and want to pass refobjects (not just values) as arguments to functions. Some code to clarify: import { defineComponent, ref } from '@vue/composition-api'
export default defineComponent({
setup() {
const dri
DarkLite1 We're using the Vue Composition API and want to pass refobjects (not just values) as arguments to functions. Some code to clarify: import { defineComponent, ref } from '@vue/composition-api'
export default defineComponent({
setup() {
const dri
DarkLite1 We're using the Vue Composition API and want to pass refobjects (not just values) as arguments to functions. Some code to clarify: import { defineComponent, ref } from '@vue/composition-api'
export default defineComponent({
setup() {
const dri
atomSmasher I've made a mistake with a socket interface that I've been writing for a while , and I just noticed this while browsing through the code to find another problem. The socket receives a string and passes it to jsoncpp to complete the json parsing. I
atomSmasher I've made a mistake with a socket interface that I've been writing for a while , and I just noticed this while browsing through the code to find another problem. The socket receives a string and passes it to jsoncpp to complete the json parsing. I
atomSmasher I've made a mistake with a socket interface that I've been writing for a while , and I just noticed this while browsing through the code to find another problem. The socket receives a string and passes it to jsoncpp to complete the json parsing. I
atomSmasher I've made a mistake with a socket interface that I've been writing for a while , and I just noticed this while browsing through the code to find another problem. The socket receives a string and passes it to jsoncpp to complete the json parsing. I
Abruzzo Forte and Gentile This is a newbie question, but I don't understand how it works. Suppose I have the following function void foo(const std::string& v) {
cout << v << endl;
}
and the call in my program below. foo("hi!");
Essentially, I'm passing a
Crusher If I understand the rules immediate functionscorrectly , the following are legal usages: consteval void func(int& a) { /* Anything here... */ }
Can this function be called? I can't find any way to do this because constevalcoercion has to call this in
Anakhand This might be something like "I can't pass a lambda as a std::function" , but it's actually passing parameters std::functionby value , so the question doesn't apply. I have the following function defined. template<typename T>
std::vector<T> countSort(
Anakhand This might be something like "I can't pass a lambda as a std::function" , but it's actually passing parameters std::functionby value , so the question doesn't apply. I have the following function defined. template<typename T>
std::vector<T> countSort(