« first day (104 days earlier)      last day (2755 days later) » 

user1881400
3:39 AM
I have some sort of obscure error telling me I cannot compare two strings using ==, but I #include <string> in every .h and .cpp file in my project. Then, I went through the project and converted all (string1 == string2) instances to (string1.compare(string2) == 0), and I still get this error.
 
user1881400
This is with Visual Studio 2015. I've tried closing VS and re-opening the solution, then rebuilding it, but to no avail. The output window delves to line 1454 in the algorithm file (that's part of C++ and not my code) as the primary source of the error, so I can't see what in my code causes it. Therefore I can't make a minimal example and would have to post all my code. I'm out of ideas.
 
user1881400
I've uploaded the .sln here: expirebox.com/download/b1a29ddcdcfa798e09dde852c5ff0988.html Thanks for your concern.
 
user1881400
6:54 AM
By systematically deleting chunks of code, I figured out this was the culprit.

urls.erase(std::remove(urls.begin(), urls.end(), posToRemove), urls.end());

With urls being a std::vector<string> and posToRemove an int. Now I need to figure out how to rewrite it tersely.
 
user1881400
7:12 AM
urls.erase(urls.begin() + posToRemove);
It helps to know what your code is doing, huh.
 
7:09 PM
How can I use std::result_of along with lambda expression? Here is my code that yields a compilation error
#include <cstdio>
#include <type_traits>

typedef int ue_t;

template<typename lambda_t, typename return_t>
return_t pob ( lambda_t f )
{
static_assert (
std::is_same < void,
std::result_of_t < f (
ue_t, return_t&
) >
>::value,
"pob requires a lambda expression that takes in a ue_t and returns void." );
}

int main() {}
 
7:33 PM
why are you treating lambda expressions specially
also:
> yields a compilation error
> doesn't mention it
 
What do you mean?
 
by this I mean that if your code fusses around and only accepts lambdas, and doesn't accept functions, function pointers, non-lambda function objects, it's broken
also you mention you get a compilation error but you don't list it so I have to waste my time copy-pasting your code to coliru
still, the immediate issue you have is that f(ue_t, return_t&) is neither a type nor an expression
> F and all types in ArgTypes can be any complete type, array of unknown bound, or (cv-qualified) void
 
sorry if that offends..
and finally I realized that the right one is lambda_t(ue_t, return_t&)
free of compilation error. Thank you and sorry about the annoyance
 
8:06 PM
just made me a rice congee with fried onions
very tasty
 

« first day (104 days earlier)      last day (2755 days later) »