Created
April 16, 2013 19:51
-
-
Save madbence/5399035 to your computer and use it in GitHub Desktop.
Szoftver laboratórium 2, 10. labor, szorgalmi
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
// ha T nem primitív típus | |
template<class T> | |
bool isPrimitiveType() { return false; } | |
// kivéve, ha pl int. | |
// a teljes megoldáshoz double, stb-re is meg kéne írni, ezért fapados kicsit :-) | |
template<> | |
bool isPrimitiveType<int>() { return true; } | |
// A módosított Array konstruktor | |
explicit Array(size_t n = maxsiz, const T& value = T()) : siz(0) { | |
if(isPrimitiveType<T>()) | |
{ | |
while (siz < n && siz < maxsiz) | |
t[siz++] = value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment