Created
December 3, 2015 11:41
-
-
Save 4e1e0603/847003f3ad18cd73d2c1 to your computer and use it in GitHub Desktop.
C++ generic `pair` type example.
This file contains 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
/// | |
/// uetoyo | |
/// | |
template<typename F, typename S> | |
class Pair | |
{ | |
public: | |
inline Pair(F first, S second) : _first(first), _second(second) | |
{ | |
} | |
private: | |
F _first; | |
S _second; | |
}; |
This file contains 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 <iostream> | |
#include "pair.hxx" | |
int main() | |
{ | |
//Pair<int, int> pair(new int(), new int()); | |
Pair<int, int> pair(1, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment