/usr/include/ETL/_handle.h is in etl-dev 1.2.1-0.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | /* === E T L =============================================================== */
/*! \file _handle.h
** $Id$
** \brief Template Object Handle Implementation
** \internal
**
** \legal
** Copyright (c) 2002 Robert B. Quattlebaum Jr.
** Copyright (c) 2007, 2008 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of
** the License, or (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
** \endlegal
**
** \note
** This is an internal header file, included by other ETL headers.
** You should not attempt to use it directly.
*/
/* ========================================================================= */
/* === S T A R T =========================================================== */
#ifndef __ETL__HANDLE_H
#define __ETL__HANDLE_H
/* === H E A D E R S ======================================================= */
#include <cassert>
#include <typeinfo>
/* === M A C R O S ========================================================= */
/* === T Y P E D E F S ===================================================== */
#define ETL_SELF_DELETING_SHARED_OBJECT
/* === C L A S S E S & S T R U C T S ======================================= */
#ifdef NDEBUG
#define assert_cast static_cast
#else
#define assert_cast dynamic_cast
#endif
_ETL_BEGIN_NAMESPACE
// Forward Declarations
template <class T> class handle;
template <class T> class loose_handle;
template <class T> class rhandle;
// ========================================================================
/*! \class shared_object _handle.h ETL/handle
** \brief Shared Object Base Class
** \see handle, loose_handle
** \writeme
*/
class shared_object
{
private:
mutable int refcount;
#ifdef ETL_LOCK_REFCOUNTS
mutable etl::mutex mtx;
#endif
protected:
shared_object():refcount(0) { }
shared_object(const shared_object&):refcount(0) { }
shared_object& operator= (const shared_object&) { return *this; }
#ifdef ETL_SELF_DELETING_SHARED_OBJECT
virtual ~shared_object() { }
#else
~shared_object() { }
#endif
public:
virtual void ref()const
{
#ifdef ETL_LOCK_REFCOUNTS
etl::mutex::lock lock(mtx);
#endif
assert(refcount>=0);
refcount++;
}
//! Returns \c false if object needs to be deleted
virtual bool unref()const
{
bool ret = true;
{
#ifdef ETL_LOCK_REFCOUNTS
etl::mutex::lock lock(mtx);
#endif
assert(refcount>0);
refcount--;
if(refcount==0) {
ret = false;
#ifdef ETL_SELF_DELETING_SHARED_OBJECT
refcount=-666;
#endif
}
}
#ifdef ETL_SELF_DELETING_SHARED_OBJECT
if (!ret)
delete this;
#endif
return ret;
}
//! Decrease reference counter without deletion of object
//! Returns \c false if references exeed and object should be deleted
virtual bool unref_inactive()const
{
bool ret = true;
{
#ifdef ETL_LOCK_REFCOUNTS
etl::mutex::lock lock(mtx);
#endif
assert(refcount>0);
refcount--;
if(refcount==0)
ret = false;
}
return ret;
}
int count()const { return refcount; }
}; // END of class shared_object
// ========================================================================
/*! \class virtual_shared_object _handle.h ETL/handle
** \brief Virtual Shared Object Base Class
** \see handle, loose_handle
** \writeme
*/
class virtual_shared_object
{
protected:
virtual_shared_object() { }
virtual_shared_object(const virtual_shared_object&) { }
virtual_shared_object& operator= (const virtual_shared_object&) { return *this; }
public:
virtual ~virtual_shared_object() { }
virtual void ref()const=0;
virtual bool unref()const=0;
virtual bool unref_inactive()const=0;
virtual int count()const=0;
}; // END of class virtual_shared_object
// ========================================================================
/*! \class handle _handle.h ETL/handle
** \brief Object Handle
** \see shared_object, loose_handle
** \writeme
*/
template <class T>
class handle
{
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef int count_type;
typedef int size_type;
protected:
#ifdef _DEBUG
public:
#endif
value_type *obj; //!< Pointer to object
public:
//! Default constructor - empty handle
handle():obj(NULL) {}
//! Constructor that constructs from a pointer to new object
handle(pointer x):obj(x)
{
if(obj)
obj->ref();
}
//! Default copy constructor
handle(const handle<value_type> &x):obj(x.get())
{
if(obj)
obj->ref();
}
//! Handle is released on deletion
~handle() { detach(); }
//! Template Assignment operator
/*! \note This class may not be necessary, and may be removed
** at some point in the future.
*/
/*
template <class U> handle<value_type> &
operator=(const handle<U> &x)
{
if(x.get()==obj)
return *this;
detach();
obj=static_cast<value_type*>(x.get());
if(obj)obj->ref();
return *this;
}
*/
//! Assignment operator
handle<value_type> &
operator=(const handle<value_type> &x)
{
if(x.get()==obj)
return *this;
detach();
obj=x.get();
if(obj)obj->ref();
return *this;
}
//! Swaps the values of two handles without reference counts
handle<value_type> &
swap(handle<value_type> &x)
{
pointer ptr=x.obj;
x.obj=obj;
obj=ptr;
return *this;
}
//! Handle detach procedure
/*! unref()'s the object and sets the internal object pointer to \c NULL */
void
detach()
{
pointer xobj(obj);
obj=0;
#ifdef ETL_SELF_DELETING_SHARED_OBJECT
if(xobj)
xobj->unref();
#else
if(xobj && !xobj->unref())
delete xobj;
#endif
}
// This will be reintroduced with a new function
//void release() { detach(); }
void reset() { detach(); }
bool empty()const { return obj==0; }
//! Creates a new instance of a T object and puts it in the handle.
/*! Uses the default constructor */
void spawn() { operator=(handle(new T())); }
//! Returns a constant handle to our object
handle<const value_type> constant()const { assert(obj); return *this; }
//! Returns number of instances
count_type
count()const
{ return obj?obj->count():0; }
//! Returns true if there is only one instance of the object
bool
unique()const
{ assert(obj); return count()==1; }
reference
operator*()const
{ assert(obj); return *obj; }
pointer
operator->()const
{ assert(obj); return obj; }
//! More explicit bool cast
operator bool()const
{ return obj!=NULL; }
operator handle<const value_type>()const
{ return handle<const value_type>(static_cast<const_pointer>(obj)); }
//! <tt> static_cast\<\> </tt> wrapper
template <class U> static handle<T> cast_static (const handle<U> &x) { return handle<T>(static_cast <T*>(x.get())); }
//! <tt> dynamic_cast\<\> </tt> wrapper
template <class U> static handle<T> cast_dynamic (const handle<U> &x) { return handle<T>(dynamic_cast <T*>(x.get())); }
//! <tt> const_cast\<\> </tt> wrapper
template <class U> static handle<T> cast_const (const handle<U> &x) { return handle<T>(const_cast <T*>(x.get())); }
//! <tt> reinterpret_cast\<\> </tt> wrapper
template <class U> static handle<T> cast_reinterpret(const handle<U> &x) { return handle<T>(reinterpret_cast<T*>(x.get())); }
template <class U> static handle<T> cast_static (const loose_handle<U> &x);
template <class U> static handle<T> cast_dynamic (const loose_handle<U> &x);
template <class U> static handle<T> cast_const (const loose_handle<U> &x);
template <class U> static handle<T> cast_reinterpret(const loose_handle<U> &x);
template <class U> static handle<T> cast_static (const rhandle<U> &x);
template <class U> static handle<T> cast_dynamic (const rhandle<U> &x);
template <class U> static handle<T> cast_const (const rhandle<U> &x);
template <class U> static handle<T> cast_reinterpret(const rhandle<U> &x);
template <class U> static handle<T> cast_static (U* x);
template <class U> static handle<T> cast_dynamic (U* x);
template <class U> static handle<T> cast_const (U* x);
template <class U> static handle<T> cast_reinterpret(U* x);
//! Returns pointer to the object that is being wrapped
pointer get()const { return obj; }
bool
operator!()const
{ return !obj; }
//! static_cast<> overload -- Useful for implicit casts
template <class U>
operator handle<U>()const
{ return handle<U>(obj); }
template<typename U>
bool type_is() const
{ return dynamic_cast<const U*>(obj); }
template<typename U>
U* type_pointer() const
{ return dynamic_cast<U*>(obj); }
template<typename U>
bool type_equal() const
{ return typeid(*obj) == typeid(U); }
}; // END of template class handle
// ========================================================================
/*! \class rshared_object _handle.h ETL/handle
** \brief Replaceable Shared Object Base Class
** \see rhandle
** \writeme
*/
class rshared_object : public shared_object
{
private:
mutable int rrefcount;
public:
void *front_;
void *back_;
protected:
rshared_object():rrefcount(0),front_(0),back_(0) { }
rshared_object(const rshared_object &other): shared_object(other), rrefcount(0),front_(0),back_(0) { }
rshared_object& operator= (const rshared_object&) { return *this; }
public:
virtual void rref()const
{ rrefcount++; }
virtual void runref()const
{
assert(rrefcount>0);
rrefcount--;
}
int rcount()const
{ return rrefcount; }
}; // END of class rshared_object
// ========================================================================
/*! \class rhandle _handle.h ETL/handle
** \brief Replaceable Object Handle
** \see rshared_object, handle, loose_handle
** \writeme
*/
template <class T>
class rhandle : public handle<T>
{
friend class rshared_object;
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef int count_type;
typedef int size_type;
using handle<value_type>::count;
using handle<value_type>::unique;
using handle<value_type>::operator bool;
using handle<value_type>::get;
using handle<value_type>::operator*;
using handle<value_type>::operator->;
/*
operator const handle<value_type>&()const
{ return *this; }
*/
private:
using handle<value_type>::obj;
rhandle<value_type> *prev_;
rhandle<value_type> *next_;
void add_to_rlist()
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
assert(obj);
obj->rref();
// If this is the first reversible handle
if(!obj->front_)
{
obj->front_=obj->back_=this;
prev_=next_=0;
return;
}
prev_=reinterpret_cast<rhandle<value_type>*>(obj->back_);
next_=0;
prev_->next_=this;
obj->back_=this;
}
void del_from_rlist()
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
assert(obj);
obj->runref();
// If this is the last reversible handle
if(obj->front_==obj->back_)
{
obj->front_=obj->back_=0;
prev_=next_=0;
return;
}
if(!prev_)
obj->front_=(void*)next_;
else
prev_->next_=next_;
if(!next_)
obj->back_=(void*)prev_;
else
next_->prev_=prev_;
}
public:
//! Default constructor - empty handle
rhandle() {}
//! Constructor that constructs from a pointer to new object
rhandle(pointer x):handle<T>(x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(obj)add_to_rlist();
}
rhandle(const handle<value_type> &x):handle<T>(x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(obj)add_to_rlist();
}
//! Default copy constructor
rhandle(const rhandle<value_type> &x):handle<T>(x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(obj)add_to_rlist();
}
//! Handle is released on deletion
~rhandle() { detach(); }
//! Template Assignment operator
/*! \note This class may not be necessary, and may be removed
** at some point in the future.
*/
/*
template <class U> const handle<value_type> &
operator=(const handle<U> &x)
{
if(x.get()==obj)
return *this;
detach();
obj=static_cast<value_type*>(x.get());
if(obj)
{
obj->ref();
add_to_rlist();
}
return *this;
}
*/
//! Assignment operator
rhandle<value_type> &
operator=(const rhandle<value_type> &x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(x.get()==obj)
return *this;
detach();
obj=x.get();
if(obj)
{
obj->ref();
add_to_rlist();
}
return *this;
}
rhandle<value_type>&
operator=(const handle<value_type> &x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(x.get()==obj)
return *this;
detach();
obj=x.get();
if(obj)
{
obj->ref();
add_to_rlist();
}
return *this;
}
rhandle<value_type>&
operator=(value_type* x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(x==obj)
return *this;
detach();
obj=x;
if(obj)
{
obj->ref();
add_to_rlist();
}
return *this;
}
//! Handle release procedure
/*! unref()'s the object and sets the internal object pointer to \c NULL */
void
detach()
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(obj)del_from_rlist();
handle<value_type>::detach();
obj=0;
}
// This will be reintroduced with a new function
//void release() { detach(); }
void reset() { detach(); }
//! Creates a new instance of a T object and puts it in the handle.
/*! Uses the default constructor */
void spawn() { operator=(handle<value_type>(new T())); }
//! Returns number of reversible instances
count_type
rcount()const
{
// value_type*const& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
return obj?obj->rcount():0;
}
//! Returns true if there is only one instance of the object
bool
runique()const
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
assert(obj); return obj->front_==obj->back_;
}
//! \writeme
int replace(const handle<value_type> &x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
assert(obj);
assert(x.get()!=obj);
if(x.get()==obj)
return 0;
rhandle<value_type> *iter;
rhandle<value_type> *next;
iter=reinterpret_cast<rhandle<value_type>*>(obj->front_);
assert(iter);
next=iter->next_;
int i=0;
#ifndef NDEBUG
pointer obj_=obj;
#endif
for(;iter;iter=next,next=iter?iter->next_:0,i++)
{
assert(iter->get()==obj_);
(*iter)=x;
}
assert(obj==x.get());
return i;
}
//! Swaps the values of two handles without reference counts
/*! \warning not yet implemented. \writeme */
handle<value_type> &
swap(handle<value_type> &x);
/*
{
assert(0);
pointer ptr=x.obj;
x.obj=obj;
obj=ptr;
return *this;
}
*/
}; // END of template class rhandle
// ========================================================================
/*! \class loose_handle _handle.h ETL/handle
** \brief Loose Object Handle
** \see shared_object, handle
** \writeme
*/
template <class T>
class loose_handle
{
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef int count_type;
typedef int size_type;
protected:
#ifdef _DEBUG
public:
#endif
value_type *obj; //!< Pointer to object
public:
//! Default constructor - empty handle
loose_handle():obj(0) {}
//! Constructor that constructs from a pointer to new object
loose_handle(pointer x):obj(x) { }
//! Default copy constructor
loose_handle(const loose_handle<value_type> &x):obj(x.get()) { }
loose_handle(const handle<value_type> &x):obj(x.get()) { }
template <class U> const loose_handle<value_type> &
operator=(const handle<U> &x)
{
if(x.get()==obj)
return *this;
obj=x.get();
return *this;
}
template <class U> const loose_handle<value_type> &
operator=(const loose_handle<U> &x)
{
if(x.get()==obj)
return *this;
obj=x.get();
return *this;
}
//! Assignment operator
const loose_handle<value_type> &
operator=(const loose_handle<value_type> &x)
{
if(x.get()==obj)
return *this;
obj=x.get();
return *this;
}
//! Swaps the values of two handles without reference counts
loose_handle<value_type> &
swap(loose_handle<value_type> &x)
{
pointer ptr=x.obj;
x.obj=obj;
obj=ptr;
return *this;
}
//! Handle release procedure
void detach() { obj=0; }
// This will be reintroduced with a new function
//void release() { detach(); }
void reset() { detach(); }
bool empty()const { return obj==0; }
//! Returns a constant handle to our object
loose_handle<const value_type> constant()const { return *this; }
//! Returns number of instances
count_type
count()const
{ return obj?obj->count():0; }
reference
operator*()const
{ assert(obj); return *obj; }
pointer
operator->()const
{ assert(obj); return obj; }
//! static_cast<> overload
//template <class U>
//operator loose_handle<U>()const
//{ return loose_handle<U>(static_cast<U*>(obj)); }
//! static_cast<> overload (for consts)
operator loose_handle<const value_type>()const
{ return loose_handle<const value_type>(static_cast<const_pointer>(obj)); }
operator handle<value_type>()const
{ return handle<value_type>(obj); }
operator rhandle<value_type>()const
{ return rhandle<value_type>(obj); }
//! Returns pointer to the object that is being wrapped
pointer get()const { return obj; }
//! More explicit bool cast
operator bool()const
{ return obj!=0; }
bool
operator!()const
{ return !obj; }
void ref() { if(obj)obj->ref(); }
bool unref() { if(obj && !obj->unref()){ obj=0; return false; } return true; }
template<typename U>
bool type_is() const
{ return dynamic_cast<const U*>(obj); }
template<typename U>
U* type_pointer() const
{ return dynamic_cast<U*>(obj); }
template<typename U>
bool type_equal() const
{ return typeid(*obj) == typeid(U); }
}; // END of template class loose_handle
// cast loose_handle<> -> handle<>
template <class T> template <class U> handle<T> handle<T>::cast_static (const loose_handle<U>& x) { return handle<T>(static_cast <T*>(x.get())); }
template <class T> template <class U> handle<T> handle<T>::cast_dynamic (const loose_handle<U>& x) { return handle<T>(dynamic_cast <T*>(x.get())); }
template <class T> template <class U> handle<T> handle<T>::cast_const (const loose_handle<U>& x) { return handle<T>(const_cast <T*>(x.get())); }
template <class T> template <class U> handle<T> handle<T>::cast_reinterpret(const loose_handle<U>& x) { return handle<T>(reinterpret_cast<T*>(x.get())); }
// cast rhandle_handle<> -> handle<>
template <class T> template <class U> handle<T> handle<T>::cast_static (const rhandle<U>& x) { return handle<T>(static_cast <T*>(x.get())); }
template <class T> template <class U> handle<T> handle<T>::cast_dynamic (const rhandle<U>& x) { return handle<T>(dynamic_cast <T*>(x.get())); }
template <class T> template <class U> handle<T> handle<T>::cast_const (const rhandle<U>& x) { return handle<T>(const_cast <T*>(x.get())); }
template <class T> template <class U> handle<T> handle<T>::cast_reinterpret(const rhandle<U>& x) { return handle<T>(reinterpret_cast<T*>(x.get())); }
// cast U* -> handle<>
template <class T> template <class U> handle<T> handle<T>::cast_static (U* x) { return handle<T>(static_cast <T*>(x)); }
template <class T> template <class U> handle<T> handle<T>::cast_dynamic (U* x) { return handle<T>(dynamic_cast <T*>(x)); }
template <class T> template <class U> handle<T> handle<T>::cast_const (U* x) { return handle<T>(const_cast <T*>(x)); }
template <class T> template <class U> handle<T> handle<T>::cast_reinterpret(U* x) { return handle<T>(reinterpret_cast<T*>(x)); }
// operator== for handle<>, loose_handle<> and T*
template <class T,class U> bool operator==(const handle <T>& lhs,const handle <U>& rhs) { return (lhs.get()==rhs.get()); }
template <class T,class U> bool operator==(const loose_handle<T>& lhs,const loose_handle<U>& rhs) { return (lhs.get()==rhs.get()); }
template <class T,class U> bool operator==(const handle <T>& lhs,const loose_handle<U>& rhs) { return (lhs.get()==rhs.get()); }
template <class T,class U> bool operator==(const loose_handle<T>& lhs,const handle <U>& rhs) { return (lhs.get()==rhs.get()); }
template <class T> bool operator==(const handle<T>& lhs,const T* rhs) { return (lhs.get()==rhs); }
template <class T> bool operator==(const loose_handle<T>& lhs,const T* rhs) { return (lhs.get()==rhs); }
template <class T> bool operator==(const T* lhs,const handle<T>& rhs) { return (lhs ==rhs.get()); }
template <class T> bool operator==(const T* lhs,const loose_handle<T>& rhs) { return (lhs ==rhs.get()); }
// operator!= for handle<>, loose_handle<> and T*
template <class T,class U> bool operator!=(const handle <T>& lhs,const handle <U>& rhs) { return (lhs.get()!=rhs.get()); }
template <class T,class U> bool operator!=(const loose_handle<T>& lhs,const loose_handle<U>& rhs) { return (lhs.get()!=rhs.get()); }
template <class T,class U> bool operator!=(const handle <T>& lhs,const loose_handle<U>& rhs) { return (lhs.get()!=rhs.get()); }
template <class T,class U> bool operator!=(const loose_handle<T>& lhs,const handle <U>& rhs) { return (lhs.get()!=rhs.get()); }
template <class T> bool operator!=(const handle<T>& lhs,const T* rhs) { return (lhs.get()!=rhs); }
template <class T> bool operator!=(const loose_handle<T>& lhs,const T* rhs) { return (lhs.get()!=rhs); }
template <class T> bool operator!=(const T* lhs,const handle<T>& rhs) { return (lhs !=rhs.get()); }
template <class T> bool operator!=(const T* lhs,const loose_handle<T>& rhs) { return (lhs !=rhs.get()); }
// operator< for handle<>, loose_handle<> and T*
template <class T,class U> bool operator<(const handle<T>& lhs,const handle<U>& rhs) { return (lhs.get()<rhs.get()); }
template <class T,class U> bool operator<(const loose_handle<T>& lhs,const loose_handle<U>& rhs) { return (lhs.get()<rhs.get()); }
template <class T,class U> bool operator<(const handle<T>& lhs,const loose_handle<U>& rhs) { return (lhs.get()<rhs.get()); }
template <class T,class U> bool operator<(const loose_handle<T>& lhs,const handle<U>& rhs) { return (lhs.get()<rhs.get()); }
template <class T> bool operator<(const handle<T>& lhs,const T* rhs) { return (lhs.get()<rhs); }
template <class T> bool operator<(const loose_handle<T>& lhs,const T* rhs) { return (lhs.get()<rhs); }
template <class T> bool operator<(const T* lhs,const handle<T>& rhs) { return (lhs <rhs.get()); }
template <class T> bool operator<(const T* lhs,const loose_handle<T>& rhs) { return (lhs <rhs.get()); }
_ETL_END_NAMESPACE
/* === E N D =============================================================== */
#endif
|