Created
May 14, 2011 21:03
-
-
Save niklasfi/972631 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g++ --std=c++0x -c ui2.cpp | |
g++ --std=c++0x test.cpp ui2.o | |
/tmp/cc4DASkN.o: In function `main': | |
test.cpp:(.text+0x20): undefined reference to `std::function<bool (int const&)> ui2::check_true<int>()' | |
collect2: ld gab 1 als Ende-Status zurüc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ui2.h" | |
int main(){ | |
std::cout << ui2::quert(4) << "\n" //works | |
<< ui2::check_true<int>()(4) << "\n"; //does not link! | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ui2.h" | |
int ui2::quert(int bar){return bar;}; | |
template <class T> std::function<bool(const T&)> ui2::check_true(){ | |
return [](const T& m) { return true; }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <functional> | |
namespace ui2{ | |
int quert(int bar); | |
template <class T> std::function<bool(const T&)> check_true(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment