Size: a a a

Чат "Программист"

2020 June 11

P

Phantom in Чат "Программист"
Лол
источник

СК

Серверный Кит... in Чат "Программист"
вот такие темплейты
источник

P

Phantom in Чат "Программист"
Серверный Кит
вот такие темплейты
Ша за темплейты
источник

СК

Серверный Кит... in Чат "Программист"
Phantom
И потом ты на синтаксис шарпа гнал
я и говорил что с цпп история хуже -_-
источник

СК

Серверный Кит... in Чат "Программист"
Phantom
Ша за темплейты
дженерики в вашем понимании
источник

СК

Серверный Кит... in Чат "Программист"
тока версия пизже
источник

P

Phantom in Чат "Программист"
Серверный Кит
дженерики в вашем понимании
Я так и понял, решил уточнить
источник

P

Phantom in Чат "Программист"
Серверный Кит
тока версия пизже
Чем?
источник

СК

Серверный Кит... in Чат "Программист"
Phantom
Чем?
в дженериках ж онли типы данных у нас можно подставлять?
источник

СК

Серверный Кит... in Чат "Программист"
в темплейтах можно хранить некоторую логику
источник

P

Phantom in Чат "Программист"
Например
источник

СК

Серверный Кит... in Чат "Программист"
и значения которые в компиль тайме подставить можно
источник

СК

Серверный Кит... in Чат "Программист"
Phantom
Например
логика: смотреть https://en.cppreference.com/w/cpp/header/type_traits

значения в компиль тайме:
template <typename T, size_t thrs_n>
источник

СК

Серверный Кит... in Чат "Программист"
smth<T, 12>();
источник

CN

Cybernetic Neuron in Чат "Программист"
Vot krch norm mishka, kak vam?
источник

СК

Серверный Кит... in Чат "Программист"
Cybernetic Neuron
Vot krch norm mishka, kak vam?
яб взял
источник

P

Phantom in Чат "Программист"
The following are the key differences between C# Generics and C++ templates:

C# generics do not provide the same amount of flexibility as C++ templates. For example, it is not possible to call arithmetic operators in a C# generic class, although it is possible to call user defined operators.

C# does not allow non-type template parameters, such as template C<int i> {}.

C# does not support explicit specialization; that is, a custom implementation of a template for a specific type.

C# does not support partial specialization: a custom implementation for a subset of the type arguments.

C# does not allow the type parameter to be used as the base class for the generic type.

C# does not allow type parameters to have default types.

In C#, a generic type parameter cannot itself be a generic, although constructed types can be used as generics. C++ does allow template parameters.

C++ allows code that might not be valid for all type parameters in the template, which is then checked for the specific type used as the type parameter. C# requires code in a class to be written in such a way that it will work with any type that satisfies the constraints. For example, in C++ it is possible to write a function that uses the arithmetic operators + and - on objects of the type parameter, which will produce an error at the time of instantiation of the template with a type that does not support these operators. C# disallows this; the only language constructs allowed are those that can be deduced from the constraints.
источник

N

NE JS-coder aka mish... in Чат "Программист"
Zowie)
источник

P

Phantom in Чат "Программист"
Cybernetic Neuron
Vot krch norm mishka, kak vam?
Чувк G502 стоит 4к
источник

СК

Серверный Кит... in Чат "Программист"
Phantom
The following are the key differences between C# Generics and C++ templates:

C# generics do not provide the same amount of flexibility as C++ templates. For example, it is not possible to call arithmetic operators in a C# generic class, although it is possible to call user defined operators.

C# does not allow non-type template parameters, such as template C<int i> {}.

C# does not support explicit specialization; that is, a custom implementation of a template for a specific type.

C# does not support partial specialization: a custom implementation for a subset of the type arguments.

C# does not allow the type parameter to be used as the base class for the generic type.

C# does not allow type parameters to have default types.

In C#, a generic type parameter cannot itself be a generic, although constructed types can be used as generics. C++ does allow template parameters.

C++ allows code that might not be valid for all type parameters in the template, which is then checked for the specific type used as the type parameter. C# requires code in a class to be written in such a way that it will work with any type that satisfies the constraints. For example, in C++ it is possible to write a function that uses the arithmetic operators + and - on objects of the type parameter, which will produce an error at the time of instantiation of the template with a type that does not support these operators. C# disallows this; the only language constructs allowed are those that can be deduced from the constraints.
sfinae))
источник