Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<>
- inline const char* begin(const char*& _Cont) noexcept
- {
- return _Cont;
- }
- inline const char* begin(const char*& Cont)
- {
- return Cont;
- }
- #include <iostream>
- const char* begin(const char* str) noexcept
- {
- return str;
- }
- const char* end(const char* str) noexcept
- {
- int count = strlen(str);
- return str + count;
- }
- int main()
- {
- for(auto c : "Hello Moscow!")
- std::cout << c;
- std::cout << "n";
- }
- #include <iostream>
- namespace std
- {
- const char* begin(const char* str) noexcept
- {
- return str;
- }
- const char* end(const char* str) noexcept
- {
- int count = strlen(str);
- return str + count;
- }
- }
- int main()
- {
- const char* str = "Hello Moscow!";
- for(auto c: str)
- std::cout << c;
- std::cout << "n";
- }
- template<class _Container>
- auto inline begin(_Container& _Cont) -> decltype(_Cont.begin())
- template<class _Container>
- auto inline begin(const _Container& _Cont) -> decltype(_Cont.begin())
- template<class _Ty, size_t _Size>
- inline_CONST_FUN _Ty *begin(_Ty (&_Array)[_Size]) _NOEXCEPT
- template<>
- inline const char* begin(const char*& _Cont) noexcept
- #include <iostream>
- #include <iterator>
- #include <vector>
- namespace std
- {
- template<>
- int *begin(int(&_Array)[50]) noexcept
- {
- std::cout << "Yeah!n";
- return nullptr;
- }
- template<>
- auto inline begin(const std::vector<int>& _Cont) -> decltype(_Cont.begin())
- {
- std::cout << "Beah!n";
- return _Cont.begin();
- }
- }
- int main()
- {
- int a[50];
- std::begin(a);
- std::begin(std::vector<int>{});
- }
Add Comment
Please, Sign In to add comment