Upgrade: address warnings -- deprecated implicit copy
Future C++ versions will no longer generate default copy operations once any single one was defined explicitly. So the goal is to kind-of ''enforce the rule of five'' (if you define one, define them all). However, sometimes one of these special operators must be defined for a different reason, e.g. because it is defined as protected, yet should not be exposed on the public API. In such cases, any other copy operation which still is valid in the default form must be declared explicitly ''as defaulted'' Overall this seems to be quite an improvement -- and it highlights (again) some known instances of questionable design, which are mostly obsoleted and require clean-up anyway, or (as in the case of the Placements) indicate »placeholder code« where the actual solution still needs to be worked out
This commit is contained in:
parent
2ff28236f6
commit
bf6532a69d
7 changed files with 37 additions and 16 deletions
|
|
@ -85,9 +85,8 @@ namespace lib {
|
|||
: str_(literal)
|
||||
{ }
|
||||
|
||||
Literal (Literal const& o) noexcept
|
||||
: str_(o.str_)
|
||||
{ }
|
||||
Literal (Literal const&) noexcept = default;
|
||||
Literal& operator= (Literal const&) noexcept = default;
|
||||
|
||||
operator CStr() const { return str_; }
|
||||
const char* c() const { return str_; }
|
||||
|
|
|
|||
|
|
@ -250,10 +250,10 @@ namespace time {
|
|||
: TimeValue(o)
|
||||
{ }
|
||||
|
||||
TimeVar&
|
||||
operator= (TimeValue const& o)
|
||||
TimeVar& operator= (TimeVar const&) = default;
|
||||
TimeVar& operator= (TimeValue const& o)
|
||||
{
|
||||
t_ = TimeVar(o);
|
||||
*this = TimeVar(o);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -318,13 +318,15 @@ namespace time {
|
|||
: TimeValue(val)
|
||||
{ }
|
||||
|
||||
explicit
|
||||
Time (FSecs const& fractionalSeconds);
|
||||
|
||||
Time (Time const&) = default;
|
||||
|
||||
Time (TimeVar const& calcResult)
|
||||
: TimeValue(calcResult)
|
||||
{ }
|
||||
|
||||
explicit
|
||||
Time (FSecs const& fractionalSeconds);
|
||||
|
||||
Time ( long millis
|
||||
, uint secs
|
||||
, uint mins =0
|
||||
|
|
@ -375,7 +377,9 @@ namespace time {
|
|||
|
||||
explicit
|
||||
Offset (FSecs const& delta_in_secs);
|
||||
|
||||
|
||||
Offset (Offset const&) = default;
|
||||
|
||||
Offset (FrameCnt count, FrameRate const& fps);
|
||||
|
||||
Offset (TimeValue const& origin, TimeValue const& target)
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ namespace engine {
|
|||
privateID_._as_pointer = impl_related_ptr;
|
||||
}
|
||||
|
||||
LocalTag (LocalTag const&) = default;
|
||||
|
||||
/** Marker when no distinct local key is given */
|
||||
static const LocalTag UNKNOWN;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ namespace mobject {
|
|||
* and reduced to simple positions. This so called Fixture
|
||||
* contains only ExplicitPlacement objects and is processed
|
||||
* by the Builder to create the render engine node network.
|
||||
*
|
||||
* @deprecated 2025/4 while we need a marker for an _explicit placement,_
|
||||
* implementing this as a subclass is the dog-no-wag-tail anti pattern.
|
||||
* Inheritance indicates a contract, but should not be abused to mark properties.
|
||||
*
|
||||
* @ingroup fixture
|
||||
* @see Placement#resolve factory method for deriving an ExplicitPlacement
|
||||
|
|
@ -57,7 +61,7 @@ namespace mobject {
|
|||
const Time time;
|
||||
const Pipe pipe;
|
||||
|
||||
typedef std::pair<Time,Pipe> SolutionData; //TODO (ichthyo considers better passing of solution by subclass)
|
||||
typedef std::pair<Time,Pipe> SolutionData; //////////////////////TICKET #100 : ichthyo considers better passing of solution by subclass...
|
||||
|
||||
/** no need to resolve any further, as this ExplicitPlacement
|
||||
* already \e is the result of a resolve()-call.
|
||||
|
|
@ -66,7 +70,7 @@ namespace mobject {
|
|||
virtual
|
||||
ExplicitPlacement resolve () const
|
||||
{
|
||||
return *this;
|
||||
return *this; // and this very special dog breaks the wag-the-tail contract :-P
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -75,13 +79,16 @@ namespace mobject {
|
|||
* of FixedLocation, which would serve as Placement::LocatingSolution, and
|
||||
* would be used as LocatingPin::chain subobject as well, so that it could
|
||||
* be initialised directly here in the ExplicitPlacement ctor.
|
||||
* (ichthyo: see Trac #100)
|
||||
* /////////////////////////////////////////////////////////TICKET #100
|
||||
*/
|
||||
ExplicitPlacement (const Placement<MObject>& base, const SolutionData found)
|
||||
ExplicitPlacement (Placement<MObject> const& base, const SolutionData found)
|
||||
: Placement<MObject>(base),
|
||||
time(found.first), pipe(found.second)
|
||||
{ };
|
||||
|
||||
|
||||
/** @warning 2025/4 design smells all over the place. It should not be copyable!! */
|
||||
ExplicitPlacement (ExplicitPlacement const&) = default;
|
||||
|
||||
friend ExplicitPlacement Placement<MObject>::resolve () const;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -197,6 +197,11 @@ namespace mobject {
|
|||
, chain(ref.chain)
|
||||
{ }
|
||||
|
||||
/** @todo 2025-4 what is the semantics of such an assignment?
|
||||
* Shouldn't placement be treated with reference semantics? //////////////////////////////////TICKET #123 : (from 2009) "Find out about the correct meaning when assigning placements...."
|
||||
*/
|
||||
Placement& operator= (Placement const&) = default;
|
||||
|
||||
protected:
|
||||
Placement (MObject & subject, Deleter killer)
|
||||
: _SmartPtr (&subject, killer) { };
|
||||
|
|
|
|||
|
|
@ -72,7 +72,9 @@ namespace test {
|
|||
Tracker (TY init = TY()) : element_(init) { ++instanceCnt; }
|
||||
Tracker (Tracker const& otr) : element_(otr.element_) { ++instanceCnt; }
|
||||
~Tracker() { --instanceCnt; }
|
||||
|
||||
|
||||
Tracker& operator= (Tracker const&) = default;
|
||||
|
||||
TY&
|
||||
operator* ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ namespace test{
|
|||
Tracker(Tracker const& ot) : i_(ot.i_) { ++cntTracker; }
|
||||
Tracker(uint i) : i_(i) { ++cntTracker; }
|
||||
~Tracker() { --cntTracker; }
|
||||
|
||||
Tracker& operator= (Tracker const&) = default;
|
||||
};
|
||||
|
||||
struct NonAssign
|
||||
|
|
|
|||
Loading…
Reference in a new issue