mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-17 10:04:35 +03:00
C++17: Class template argument deduction (#131)
* C++17: Class template argument deduction Fixed the user-defined deduction guide. * Update README
This commit is contained in:
2
CPP17.md
2
CPP17.md
@@ -383,7 +383,7 @@ struct container {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// deduction guide
|
// deduction guide
|
||||||
template <template Iter>
|
template <typename Iter>
|
||||||
container(Iter b, Iter e) -> container<typename std::iterator_traits<Iter>::value_type>;
|
container(Iter b, Iter e) -> container<typename std::iterator_traits<Iter>::value_type>;
|
||||||
|
|
||||||
container a{ 7 }; // OK: deduces container<int>
|
container a{ 7 }; // OK: deduces container<int>
|
||||||
|
|||||||
@@ -1047,7 +1047,7 @@ struct container {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// deduction guide
|
// deduction guide
|
||||||
template <template Iter>
|
template <typename Iter>
|
||||||
container(Iter b, Iter e) -> container<typename std::iterator_traits<Iter>::value_type>;
|
container(Iter b, Iter e) -> container<typename std::iterator_traits<Iter>::value_type>;
|
||||||
|
|
||||||
container a{ 7 }; // OK: deduces container<int>
|
container a{ 7 }; // OK: deduces container<int>
|
||||||
|
|||||||
Reference in New Issue
Block a user