00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00051 #ifndef STLSOFT_INCL_STLSOFT_SMARTPTR_HPP_SCOPED_HANDLE
00052 #define STLSOFT_INCL_STLSOFT_SMARTPTR_HPP_SCOPED_HANDLE
00053
00054 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00055 # define STLSOFT_VER_STLSOFT_SMARTPTR_HPP_SCOPED_HANDLE_MAJOR 5
00056 # define STLSOFT_VER_STLSOFT_SMARTPTR_HPP_SCOPED_HANDLE_MINOR 4
00057 # define STLSOFT_VER_STLSOFT_SMARTPTR_HPP_SCOPED_HANDLE_REVISION 3
00058 # define STLSOFT_VER_STLSOFT_SMARTPTR_HPP_SCOPED_HANDLE_EDIT 667
00059 #endif
00060
00061
00062
00063
00064
00065 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00066 # include <stlsoft/stlsoft.h>
00067 #endif
00068
00069 #if defined(STLSOFT_COMPILER_IS_BORLAND)
00070 # include <stlsoft/smartptr/scoped_handle_borland_.hpp>
00071 #else
00072
00073
00074
00075
00076
00077 #if defined(STLSOFT_COMPILER_IS_MSVC) && \
00078 _MSC_VER >= 1400
00079 # pragma warning(push)
00080 # pragma warning(disable : 4191)
00081 #endif
00082
00083
00084
00085
00086
00087 #ifndef _STLSOFT_NO_NAMESPACE
00088 namespace stlsoft
00089 {
00090 #endif
00091
00092
00093
00094
00095
00096 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00097
00098
00099 template <ss_typename_param_k H>
00100 struct H_holder
00101 {
00104 public:
00105 typedef H resource_type;
00106 typedef H handle_type;
00107 typedef H_holder<H> class_type;
00109
00112 public:
00113 H_holder(H h)
00114 : bPointer(false)
00115 {
00116 this->u.h = h;
00117 }
00118 H_holder(H* ph)
00119 : bPointer(true)
00120 {
00121 this->u.ph = ph;
00122 }
00124
00127 public:
00128 H get() const
00129 {
00130 return bPointer ? *u.ph : u.h;
00131 }
00132 void set(H h)
00133 {
00134 (bPointer ? *u.ph : u.h) = h;
00135 }
00137
00140 public:
00141 union
00142 {
00143 H h;
00144 H* ph;
00145 } u;
00146 const bool bPointer;
00148
00149 private:
00150 H_holder(class_type const&);
00151 class_type& operator =(class_type const&);
00152 };
00153
00154 # ifdef STLSOFT_CF_CDECL_SUPPORTED
00155 template< ss_typename_param_k H
00156 , ss_typename_param_k R
00157 >
00158 struct function_translator_cdecl
00159 {
00160 private:
00161 typedef void (STLSOFT_CDECL* degenerate_function_type)();
00162 public:
00163 typedef R (STLSOFT_CDECL* function_type)(H);
00164 typedef R (STLSOFT_CDECL* indirect_function_type)(H*);
00165 typedef H_holder<H> holder_type;
00166
00167 static void translate(holder_type& h, degenerate_function_type pv)
00168 {
00169 function_type fn = reinterpret_cast<function_type>(pv);
00170
00171 STLSOFT_ASSERT(!h.bPointer);
00172 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00173
00174 fn(h.u.h);
00175 }
00176
00177 static void translate_indirect(holder_type& h, degenerate_function_type pv)
00178 {
00179 indirect_function_type fn = reinterpret_cast<indirect_function_type>(pv);
00180
00181 STLSOFT_ASSERT(h.bPointer);
00182 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00183
00184 fn(h.u.ph);
00185 }
00186 };
00187 # endif
00188
00189 # ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00190 template< ss_typename_param_k H
00191 , ss_typename_param_k R
00192 >
00193 struct function_translator_fastcall
00194 {
00195 private:
00196 typedef void (STLSOFT_CDECL* degenerate_function_type)();
00197 public:
00198 typedef R (STLSOFT_FASTCALL* function_type)(H);
00199 typedef R (STLSOFT_FASTCALL* indirect_function_type)(H*);
00200 typedef H_holder<H> holder_type;
00201
00202 static void translate(holder_type& h, degenerate_function_type pv)
00203 {
00204 function_type fn = reinterpret_cast<function_type>(pv);
00205
00206 STLSOFT_ASSERT(!h.bPointer);
00207 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00208
00209 fn(h.u.h);
00210 }
00211
00212 static void translate_indirect(holder_type& h, degenerate_function_type pv)
00213 {
00214 indirect_function_type fn = reinterpret_cast<indirect_function_type>(pv);
00215
00216 STLSOFT_ASSERT(h.bPointer);
00217 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00218
00219 fn(h.u.ph);
00220 }
00221 };
00222 # endif
00223
00224 # ifdef STLSOFT_CF_STDCALL_SUPPORTED
00225 template< ss_typename_param_k H
00226 , ss_typename_param_k R
00227 >
00228 struct function_translator_stdcall
00229 {
00230 private:
00231 typedef void (STLSOFT_CDECL* degenerate_function_type)();
00232 public:
00233 typedef R (STLSOFT_STDCALL* function_type)(H);
00234 typedef R (STLSOFT_STDCALL* indirect_function_type)(H*);
00235 typedef H_holder<H> holder_type;
00236
00237 static void translate(holder_type& h, degenerate_function_type pv)
00238 {
00239 function_type fn = reinterpret_cast<function_type>(pv);
00240
00241 STLSOFT_ASSERT(!h.bPointer);
00242 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00243
00244 fn(h.u.h);
00245 }
00246
00247 static void translate_indirect(holder_type& h, degenerate_function_type pv)
00248 {
00249 indirect_function_type fn = reinterpret_cast<indirect_function_type>(pv);
00250
00251 STLSOFT_ASSERT(h.bPointer);
00252 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00253
00254 fn(h.u.ph);
00255 }
00256 };
00257 # endif
00258
00259
00260
00261 # ifdef STLSOFT_CF_CDECL_SUPPORTED
00262 template< ss_typename_param_k R
00263 >
00264 struct function_translator_cdecl_void
00265 {
00266 private:
00267 typedef void (STLSOFT_CDECL *degenerate_function_type)();
00268 public:
00269 typedef R (STLSOFT_CDECL *function_type)(void);
00270
00271 static void translate(degenerate_function_type pv)
00272 {
00273 function_type fn = reinterpret_cast<function_type>(pv);
00274
00275 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00276
00277 fn();
00278 }
00279 };
00280 # endif
00281
00282 # ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00283 template< ss_typename_param_k R
00284 >
00285 struct function_translator_fastcall_void
00286 {
00287 private:
00288 typedef void (STLSOFT_CDECL *degenerate_function_type)();
00289 public:
00290 typedef R (STLSOFT_FASTCALL *function_type)(void);
00291
00292 static void translate(degenerate_function_type pv)
00293 {
00294 function_type fn = reinterpret_cast<function_type>(pv);
00295
00296 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00297
00298 fn();
00299 }
00300 };
00301 # endif
00302
00303 # ifdef STLSOFT_CF_STDCALL_SUPPORTED
00304 template< ss_typename_param_k R
00305 >
00306 struct function_translator_stdcall_void
00307 {
00308 private:
00309 typedef void (STLSOFT_CDECL *degenerate_function_type)();
00310 public:
00311 typedef R (STLSOFT_STDCALL *function_type)(void);
00312
00313 static void translate(degenerate_function_type pv)
00314 {
00315 function_type fn = reinterpret_cast<function_type>(pv);
00316
00317 STLSOFT_MESSAGE_ASSERT("function pointer must not be NULL", NULL != fn);
00318
00319 fn();
00320 }
00321 };
00322 # endif
00323
00324
00325
00326
00327 #endif
00328
00329
00365 template<ss_typename_param_k H>
00366 class scoped_handle
00367 {
00370 private:
00371 typedef void (STLSOFT_CDECL* degenerate_function_type)();
00372 typedef H_holder<H> holder_type;
00373 public:
00375 typedef H resource_type;
00377 typedef H handle_type;
00379 typedef scoped_handle<H> class_type;
00381
00384 public:
00385 #ifdef STLSOFT_CF_CDECL_SUPPORTED
00386 # if !defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT) || \
00387 defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED)
00389 scoped_handle( resource_type h
00390 , void (STLSOFT_CDECL *f)(resource_type)
00391 , resource_type hNull = 0)
00392 : m_hh(h)
00393 , m_hNull(hNull)
00394 , m_tfn(&function_translator_cdecl<H, void>::translate)
00395 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00396 {
00397 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00398 }
00399
00401 scoped_handle( resource_type* ph
00402 , void (STLSOFT_CDECL *f)(resource_type*)
00403 , resource_type hNull = 0)
00404 : m_hh(ph)
00405 , m_hNull(hNull)
00406 , m_tfn(&function_translator_cdecl<H, void>::translate_indirect)
00407 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00408 {
00409 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00410 }
00411 # endif
00412
00413 # if defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT)
00415 template <ss_typename_param_k R>
00416 scoped_handle( resource_type h
00417 , R (STLSOFT_CDECL *f)(resource_type)
00418 , resource_type hNull = 0)
00419 : m_hh(h)
00420 , m_hNull(hNull)
00421 , m_tfn(&function_translator_cdecl<H, R>::translate)
00422 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00423 {
00424 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00425 }
00427 template <ss_typename_param_k R>
00428 scoped_handle( resource_type* ph
00429 , R (STLSOFT_CDECL *f)(resource_type*)
00430 , resource_type hNull = 0)
00431 : m_hh(ph)
00432 , m_hNull(hNull)
00433 , m_tfn(&function_translator_cdecl<H, R>::translate_indirect)
00434 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00435 {
00436 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00437 }
00438 # endif
00439 #endif
00440
00441 #ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00442 # if !defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT) || \
00443 defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED)
00445 scoped_handle( resource_type h
00446 , void (STLSOFT_FASTCALL *f)(resource_type)
00447 , resource_type hNull = 0)
00448 : m_hh(h)
00449 , m_hNull(hNull)
00450 , m_tfn(&function_translator_fastcall<H, void>::translate)
00451 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00452 {
00453 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00454 }
00456 scoped_handle( resource_type h
00457 , void (STLSOFT_FASTCALL *f)(resource_type *)
00458 , resource_type hNull = 0)
00459 : m_hh(h)
00460 , m_hNull(hNull)
00461 , m_tfn(&function_translator_fastcall<H, void>::translate_indirect)
00462 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00463 {
00464 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00465 }
00466 # endif
00467
00468 # if defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT)
00470 template <ss_typename_param_k R>
00471 scoped_handle( resource_type h
00472 , R (STLSOFT_FASTCALL *f)(resource_type)
00473 , resource_type hNull = 0)
00474 : m_hh(h)
00475 , m_hNull(hNull)
00476 , m_tfn(&function_translator_fastcall<H, R>::translate)
00477 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00478 {
00479 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00480 }
00482 template <ss_typename_param_k R>
00483 scoped_handle( resource_type* ph
00484 , R (STLSOFT_FASTCALL *f)(resource_type*)
00485 , resource_type hNull = 0)
00486 : m_hh(ph)
00487 , m_hNull(hNull)
00488 , m_tfn(&function_translator_fastcall<H, R>::translate_indirect)
00489 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00490 {
00491 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00492 }
00493 # endif
00494 #endif
00495
00496
00497 #ifdef STLSOFT_CF_STDCALL_SUPPORTED
00498 # if !defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT) || \
00499 defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED)
00501 scoped_handle( resource_type h
00502 , void (STLSOFT_STDCALL *f)(resource_type)
00503 , resource_type hNull = 0)
00504 : m_hh(h)
00505 , m_hNull(hNull)
00506 , m_tfn(&function_translator_stdcall<H, void>::translate)
00507 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00508 {
00509 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00510 }
00512 scoped_handle( resource_type* ph
00513 , void (STLSOFT_STDCALL *f)(resource_type*)
00514 , resource_type hNull = 0)
00515 : m_hh(ph)
00516 , m_hNull(hNull)
00517 , m_tfn(&function_translator_stdcall<H, void>::translate_indirect)
00518 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00519 {
00520 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00521 }
00522 # endif
00523
00524 # if defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT)
00526 template <ss_typename_param_k R>
00527 scoped_handle( resource_type h
00528 , R (STLSOFT_STDCALL *f)(resource_type)
00529 , resource_type hNull = 0)
00530 : m_hh(h)
00531 , m_hNull(hNull)
00532 , m_tfn(&function_translator_stdcall<H, R>::translate)
00533 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00534 {
00535 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00536 }
00538 template <ss_typename_param_k R>
00539 scoped_handle( resource_type* ph
00540 , R (STLSOFT_STDCALL *f)(resource_type*)
00541 , resource_type hNull = 0)
00542 : m_hh(ph)
00543 , m_hNull(hNull)
00544 , m_tfn(&function_translator_stdcall<H, R>::translate_indirect)
00545 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00546 {
00547 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00548 }
00549 # endif
00550 #endif
00551
00556 ~scoped_handle()
00557 {
00558 STLSOFT_MESSAGE_ASSERT("Invariant violation: function pointer must not be NULL", NULL != m_fn);
00559
00560 if(!empty())
00561 {
00562 m_tfn(m_hh, m_fn);
00563 }
00564 }
00566
00569 public:
00571 bool empty() const
00572 {
00573 STLSOFT_MESSAGE_ASSERT("Invariant violation: function pointer must not be NULL", NULL != m_fn);
00574
00575 return get_null_value_() == m_hh.get();
00576 }
00578
00581 public:
00585 void close()
00586 {
00587 STLSOFT_MESSAGE_ASSERT("Invariant violation: function pointer must not be NULL", NULL != m_fn);
00588
00589 if(!empty())
00590 {
00591 m_tfn(m_hh, m_fn);
00592
00593 m_hh.set(get_null_value_());
00594 }
00595 }
00596
00601 resource_type detach()
00602 {
00603 STLSOFT_MESSAGE_ASSERT("Invariant violation: function pointer must not be NULL", NULL != m_fn);
00604
00605 resource_type h = m_hh.get();
00606
00607 m_hh.set(get_null_value_());
00608
00609 return h;
00610 }
00612
00615 public:
00620 resource_type handle() const
00621 {
00622 #if defined(STLSOFT_COMPILER_IS_WATCOM)
00623 return (resource_type)(m_hh.get());
00624 #else
00625 return const_cast<resource_type>(m_hh.get());
00626 #endif
00627 }
00630 resource_type get() const
00631 {
00632 return const_cast<class_type&>(*this).m_hh.get();
00633 }
00635
00638 private:
00639 resource_type get_null_value_() const
00640 {
00641 return m_hNull;
00642 }
00644
00647 private:
00648 holder_type m_hh;
00649 const resource_type m_hNull;
00650 void (*m_tfn)(holder_type&, degenerate_function_type);
00651 degenerate_function_type m_fn;
00652
00653
00656 private:
00657 scoped_handle(class_type const&);
00658 class_type& operator =(class_type const&);
00660 };
00661
00662
00663
00664
00665
00666 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00667
00668 STLSOFT_TEMPLATE_SPECIALISATION
00669 class scoped_handle<void>
00670 {
00673 private:
00674 typedef void (STLSOFT_CDECL *degenerate_function_type)();
00675 public:
00677 typedef void resource_type;
00679 typedef void handle_type;
00681 typedef scoped_handle<void> class_type;
00683
00686 public:
00687 #ifdef STLSOFT_CF_CDECL_SUPPORTED
00688 # if !defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT) || \
00689 defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED)
00691 scoped_handle( void (STLSOFT_CDECL *f)())
00692 : m_bInvoked(false)
00693 , m_tfn(&function_translator_cdecl_void<void>::translate)
00694 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00695 {
00696 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00697 }
00698 # endif
00699
00700 # if defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT)
00702 template <ss_typename_param_k R>
00703 scoped_handle( R (STLSOFT_CDECL *f)())
00704 : m_bInvoked(false)
00705 , m_tfn(&function_translator_cdecl_void<R>::translate)
00706 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00707 {
00708 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00709 }
00710 # endif
00711 #endif
00712
00713 #ifdef STLSOFT_CF_FASTCALL_SUPPORTED
00714 # if !defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT) || \
00715 defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED)
00717 scoped_handle( void (STLSOFT_FASTCALL *f)())
00718 : m_bInvoked(false)
00719 , m_tfn(&function_translator_fastcall_void<void>::translate)
00720 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00721 {
00722 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00723 }
00724 # endif
00725
00726 # if defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT)
00728 template <ss_typename_param_k R>
00729 scoped_handle( R (STLSOFT_FASTCALL *f)())
00730 : m_bInvoked(false)
00731 , m_tfn(&function_translator_fastcall_void<R>::translate)
00732 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00733 {
00734 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00735 }
00736 # endif
00737 #endif
00738
00739
00740 #ifdef STLSOFT_CF_STDCALL_SUPPORTED
00741 # if !defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT) || \
00742 defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_OVERLOAD_DISCRIMINATED)
00744 scoped_handle( void (STLSOFT_STDCALL *f)())
00745 : m_bInvoked(false)
00746 , m_tfn(&function_translator_stdcall_void<void>::translate)
00747 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00748 {
00749 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00750 }
00751 # endif
00752
00753 # if defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT)
00755 template <ss_typename_param_k R>
00756 scoped_handle( R (STLSOFT_STDCALL *f)())
00757 : m_bInvoked(false)
00758 , m_tfn(&function_translator_stdcall_void<R>::translate)
00759 , m_fn(reinterpret_cast<degenerate_function_type>(f))
00760 {
00761 STLSOFT_MESSAGE_ASSERT("Precondition violation: cannot initialise with a NULL function pointer", NULL != f);
00762 }
00763 # endif
00764 #endif
00765
00770 ~scoped_handle()
00771 {
00772 close();
00773 }
00775
00778 public:
00780 bool empty() const
00781 {
00782 return m_bInvoked;
00783 }
00785
00788 public:
00792 void close()
00793 {
00794 if(!empty())
00795 {
00796 m_tfn(m_fn);
00797 m_bInvoked = true;
00798 }
00799 }
00800
00805 resource_type detach()
00806 {
00807 m_bInvoked = true;
00808 }
00810
00813 public:
00818 resource_type handle() const
00819 {
00820 }
00823 resource_type get() const
00824 {
00825 }
00827
00830 private:
00831 ss_bool_t m_bInvoked;
00832 void (*m_tfn)(degenerate_function_type);
00833 degenerate_function_type m_fn;
00834
00835
00838 private:
00839 scoped_handle(class_type const&);
00840 class_type& operator =(class_type const&);
00842 };
00843
00844 #endif
00845
00846
00847
00848
00849
00850 template< ss_typename_param_k H
00851 >
00852 inline void swap(scoped_handle<H>& lhs, scoped_handle<H>& rhs)
00853 {
00854 lhs.swap(rhs);
00855 }
00856
00858
00859
00860 template<ss_typename_param_k H>
00861 #if defined(STLSOFT_COMPILER_IS_WATCOM)
00862 inline H get_handle(scoped_handle<H> const& h)
00863 #else
00864 inline ss_typename_type_ret_k scoped_handle<H>::handle_type get_handle(scoped_handle<H> const& h)
00865 #endif
00866 {
00867 return h.get();
00868 }
00869
00870
00871
00872
00873
00874 #ifdef STLSOFT_UNITTEST
00875 # include "./unittest/scoped_handle_unittest_.h"
00876 #endif
00877
00878
00879
00880 #ifndef _STLSOFT_NO_NAMESPACE
00881 }
00882 #endif
00883
00884
00885
00886
00887 #if defined(STLSOFT_CF_std_NAMESPACE)
00888 # if ( ( defined(STLSOFT_COMPILER_IS_INTEL) && \
00889 defined(_MSC_VER))) && \
00890 _MSC_VER < 1310
00891 namespace std
00892 {
00893 template< ss_typename_param_k H
00894 >
00895 inline void swap(stlsoft_ns_qual(scoped_handle)<H>& lhs, stlsoft_ns_qual(scoped_handle)<H>& rhs)
00896 {
00897 lhs.swap(rhs);
00898 }
00899 }
00900 # endif
00901 #endif
00902
00903
00904
00905 #endif
00906
00907
00908
00909
00910
00911 #if defined(STLSOFT_COMPILER_IS_MSVC) && \
00912 _MSC_VER >= 1400
00913 # pragma warning(pop)
00914 #endif
00915
00916
00917
00918 #endif
00919
00920