Created
September 21, 2012 15:10
-
-
Save yifu/3762070 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
| #include <iostream> | |
| template <int length> | |
| int foo( const char tab[length] ) | |
| { | |
| return sizeof( length ); | |
| } | |
| template <size_t N> | |
| //int bar( const char tab[N] ) | |
| int bar( const char (&tab)[N] ) | |
| { | |
| return sizeof( tab ); | |
| } | |
| int main() | |
| { | |
| std::cout << "hello world" << std::endl; | |
| char test[11]; | |
| std::cout << "length = " << bar( test ) << std::endl; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment