mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
T.65: fix code examples
This commit is contained in:
parent
3acba2ebae
commit
2b80bc92a5
|
@ -15126,11 +15126,11 @@ Specialization offers a powerful mechanism for providing alternative implementat
|
||||||
This is a simplified version of `std::copy` (ignoring the possibility of non-contiguous sequences)
|
This is a simplified version of `std::copy` (ignoring the possibility of non-contiguous sequences)
|
||||||
|
|
||||||
struct pod_tag {};
|
struct pod_tag {};
|
||||||
struct non_pod_tag;
|
struct non_pod_tag {};
|
||||||
|
|
||||||
template<class T> struct copy_trait { using tag = non_pod_tag; }; // T is not "plain old data"
|
template<class T> struct copy_trait { using tag = non_pod_tag; }; // T is not "plain old data"
|
||||||
|
|
||||||
template<> struct copy_trait<int> { using tab = pod_tag; }; // int is "plain old data"
|
template<> struct copy_trait<int> { using tag = pod_tag; }; // int is "plain old data"
|
||||||
|
|
||||||
template<class Iter>
|
template<class Iter>
|
||||||
Out copy_helper(Iter first, Iter last, Iter out, pod_tag)
|
Out copy_helper(Iter first, Iter last, Iter out, pod_tag)
|
||||||
|
@ -15163,7 +15163,7 @@ This is a general and powerful technique for compile-time algorithm selection.
|
||||||
When `concept`s become widely available such alternatives can be distinguished directly:
|
When `concept`s become widely available such alternatives can be distinguished directly:
|
||||||
|
|
||||||
template<class Iter>
|
template<class Iter>
|
||||||
requires Pod<Value_type_iter>
|
requires Pod<Value_type<iter>>
|
||||||
Out copy_helper(In, first, In last, Out out)
|
Out copy_helper(In, first, In last, Out out)
|
||||||
{
|
{
|
||||||
// use memmove
|
// use memmove
|
||||||
|
|
Loading…
Reference in New Issue
Block a user