template argument deduction/substitution failed, when using std::function and std::bind
To figure out the problem let separate statements: setCallback needs to know type of T and it can’t deduce it from f, so give it a type
To figure out the problem let separate statements: setCallback needs to know type of T and it can’t deduce it from f, so give it a type
To read a whole line, use rather than You might consider renaming nameFileout since it isn’t a name, and is for input not output.
I made a class with private name, units sold, and units remaining. I made two class methods that return, units sold and units remaining as ints. I want to sort the units sold from greatest to least, but I get errors as I explain in the comments. What am I doing wrong, is it something … Read more
You’ve got the declaration in the cpp file and the definition in the header, it should really be the other way round. After you’ve swapped the files round remove using namespace std; from functia.h as it’s not good practice to pull in namespaces in header files. You’ll need to change the declaration to void fun(std::vector<double> … Read more
cot(x) = cos(x)/sin(x) should be more numerically stable close to π/2 than cot(x) = 1/tan(x). You can implement that efficiently using sincos on platforms that have it. Another possibility is cot(x) = tan(M_PI_2 – x). This should be faster than the above (even if sincos is available), but it may also be less accurate, because … Read more
Simple math: log2 (x) = logy (x) / logy (2) where y can be anything, which for standard log functions is either 10 or e.
Got it. I assumed it’d figure out that the > operator returned a bool (per documentation). But apparently it is not so.
If you are using a Mac, you can select MacOS GCC instead of Cross GCC. If you are on Windows, you will have to install a C++ compiler. I recommend you install Cygwin, try following the directions here. https://www3.ntu.edu.sg/home/ehchua/programming/howto/eclipsecpp_howto.html Once you’ve installed the C++ compiler, restart Eclipse and try to create the project again. Hope this helps.
operator+() should not return a reference type as it is a new (locally declared) instance that holds the result of the operation.
You should use new when you wish an object to remain in existence until you delete it. If you do not use new then the object will be destroyed when it goes out of scope. Some examples of this are: Some people will say that the use of new decides whether your object is on the heap or the stack, but that is … Read more