|
|
|
|
|
by AnimalMuppet
3992 days ago
|
|
> Yeah, that would be Concepts. IIRC, C++ doesn't have them landed yet. I also believe that C++ doesn't have them yet. > But the benefit of generics is that the "things that fit that function" are auto-generated. But because of the way that Go interfaces are in essence duck typed, "things that fit that function" are also auto-generated, other than having to specify the interface that must be satisfied. To me, this seems like no more work than specifying the C++ concept. (Or am I still missing something?) |
|
No, you have to write their code (concrete implementation for a new type) manually.
The only thing that's automatic is that the new implementation is "registered" as compatible with the interface without you having to explicitly declare it (e.g. not like Java that needs you to write "extends IFoo").