Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

[CONNECT C++] Element Creation Functions and const-ness

$
0
0

The mdlXxx_create functions take an element template as the second parameter.  For example...

mdlCircle_createBy3Pts (MSElementP out, MSElementP in, DPoint3dP pt, int fillMode)

The purpose of that template is to provide the new element with a set of characteristics. That way, we don't have to set symbology on the new element, for example.

Why is the template a non-const pointer?  If the template element is not modified, then a const pointer should be fine.  Is it safe to perform a const_cast if my template element is const?  For example, is the following reasonable?

ElementHandle eh (...);
MSElement circle;
DPoint3d origin { 1., 1., 0. };
mdlCircle_createBy3Pts (&circle, const_cast<MSElementP>(eh.GetElementCP ()), &origin, 0);

Note that ElementHandle does not have a member GetElementP().


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>