Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Apress/beginning-cpp20
/ my_size
Function
my_size
Exercises/NoModules/Chapter 10/Soln10_04.cpp:10–10 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
8
// Look ma, no sizeof()!
9
template <typename T, size_t N>
10
size_t my_size(const T (&array)[N]) { return N; }
11
12
// Overload with two other templates for std::vector<> and array<>
13
template <typename T>
Callers
1
main
Function · 0.70
Calls
1
size
Method · 0.45
Tested by
no test coverage detected