zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2k stars 592 forks source link

Simplify how the Slice Compiler Checks Element Types #2292

Closed InsertCreativityHere closed 2 weeks ago

InsertCreativityHere commented 2 weeks ago

Currently, the Slice compiler has a large API surface just for checking "does this type contain any X"? Most crazily, we have a separate function for each type we'd want to check: hasClassDefs, hasOperations, hasStructs, ... We also have a general purpose hasContained, which already makes those above functions redundant.

But this PR goes a step further. It deletes all the machinery, types, and functions for checking this, and replaces them with a single template function: Container::contains<T>().


Question for @bernardnormier, I came across this comment: https://github.com/zeroc-ice/ice/blob/71e30b88a5289221fda395b3185494c2aa6d2b6d/cpp/src/slice2cpp/Gen.cpp#L1998-L2002 What's the concern that it's talking about? It's not entirely clear to me.