VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlSmartPointers.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2025 MAK Technologies, Inc
3 ** All rights reserved.
4 ******************************************************************************/
9 #pragma once
10 
16 #ifndef BOOST_HAS_THREADS
17 #define BOOST_HAS_THREADS
18 #endif
19 
20 #include <memory>
21 
22 #ifdef DtUSE_UTILITIES_NAMESPACE
23 namespace DtUSE_UTILITIES_NAMESPACE
24 {
25 #endif
26 
34 template <typename T>
35 bool DtValidAndEqual(const std::weak_ptr<T>& wp1,
36  const std::weak_ptr<T>& wp2)
37 {
38  std::shared_ptr<T> sp1 = wp1.lock();
39  std::shared_ptr<T> sp2 = wp2.lock();
40 
42  return (sp1 && sp2) && (sp1 == sp2);
43 }
44 
46 template <typename T>
56 bool DtValidAndEqual(const std::shared_ptr<T>& sp1,
57  const std::weak_ptr<T>& wp1)
58 {
59  std::shared_ptr<T> sp2 = wp1.lock();
61  return (sp2) && (sp1 == sp2);
62 }
63 
64 template <typename T>
65 bool DtValidAndEqual(const std::weak_ptr<T>& wp1,
66  const std::shared_ptr<T>& sp1)
67 {
68  std::shared_ptr<T> sp2 = wp1.lock();
70  return (sp2) && (sp1 == sp2);
71 }
73 
74 #ifdef DtUSE_UTILITIES_NAMESPACE
75 }
76 #endif
77 
78 
bool DtValidAndEqual(const std::weak_ptr< T > &wp1, const std::weak_ptr< T > &wp2)
Compare if two weak pointers are both valid and equal.
Definition: vlSmartPointers.h:35

Document ID: Generated on Thu Oct 16 00:12:25 EDT 2025 from SVN revision 280738
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)