480 unsigned int nbok = 0;
481 DummyTbl a1( 100, 10 );
482 DummyTbl* ptr_a2 =
new DummyTbl( 100, 18 );
494 trace.
beginBlock (
"Alias: #DummyTbl with DummyTbl& to DummyTbl& member. no duplication (0/0)" );
495 AliasToRefMember c00( a1 );
496 trace.
info() <<
"D: d1.value() = " << c00.value() << std::endl;
497 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
498 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
499 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
500 <<
" nbCreated=" << DummyTbl::nbCreated
501 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
504 trace.
beginBlock (
"Alias: #DummyTbl with DummyTbl* to DummyTbl& member. no duplication (0/0)" );
505 AliasToRefMember c10( ptr_a2 );
506 trace.
info() <<
"D: d1.value() = " << c10.value() << std::endl;
507 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
508 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
509 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
510 <<
" nbCreated=" << DummyTbl::nbCreated
511 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
514 trace.
beginBlock (
"Alias: #DummyTbl with DummyTbl& to DummyTbl* member. no duplication (0/0)" );
515 AliasToPtrMember c01( a1 );
516 trace.
info() <<
"D: d1.value() = " << c01.value() << std::endl;
517 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
518 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
519 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
520 <<
" nbCreated=" << DummyTbl::nbCreated
521 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
524 trace.
beginBlock (
"Alias: #DummyTbl with DummyTbl* to DummyTbl* member. no duplication (0/0)" );
525 AliasToPtrMember c11( ptr_a2 );
526 trace.
info() <<
"D: d1.value() = " << c11.value() << std::endl;
527 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
528 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
529 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
530 <<
" nbCreated=" << DummyTbl::nbCreated
531 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
534 trace.
beginBlock (
"Alias: #DummyTbl with DummyTbl& to CountedPtrOrPtr<DummyTbl> member. no duplication (0/0)" );
535 AliasToCountedPtrOrPtrMember c06( a1 );
536 trace.
info() <<
"D: d1.value() = " << c06.value() << std::endl;
537 trace.
info() << c06.myDummyTbl << std::endl;
538 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
539 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
540 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
541 <<
" nbCreated=" << DummyTbl::nbCreated
542 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
545 trace.
beginBlock (
"Alias: #DummyTbl with DummyTbl* to CountedPtrOrPtr<DummyTbl> member. no duplication (0/0)" );
546 AliasToCountedPtrOrPtrMember c16( a1 );
547 trace.
info() <<
"D: d1.value() = " << c16.value() << std::endl;
548 trace.
info() << c16.myDummyTbl << std::endl;
549 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
550 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
551 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
552 <<
" nbCreated=" << DummyTbl::nbCreated
553 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
579 unsigned int nbok = 0;
580 DummyTbl a1( 100, 10 );
581 DummyTbl* ptr_a2 =
new DummyTbl( 100, 18 );
595 trace.
beginBlock (
"ConstAlias: #DummyTbl with const DummyTbl& to const DummyTbl& member. no duplication (0/0)" );
596 ConstAliasToConstRefMember c00( a1 );
597 trace.
info() <<
"D: d1.value() = " << c00.value() << std::endl;
598 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
599 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
600 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
601 <<
" nbCreated=" << DummyTbl::nbCreated
602 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
605 trace.
beginBlock (
"ConstAlias: #DummyTbl with const DummyTbl* to const DummyTbl& member. no duplication (0/0)" );
606 ConstAliasToConstRefMember c10( ptr_a2 );
607 trace.
info() <<
"D: d1.value() = " << c10.value() << std::endl;
608 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
609 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
610 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
611 <<
" nbCreated=" << DummyTbl::nbCreated
612 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
615 trace.
beginBlock (
"ConstAlias: #DummyTbl with const DummyTbl& to const DummyTbl* member. no duplication (0/0)" );
616 ConstAliasToConstPtrMember c01( a1 );
617 trace.
info() <<
"D: d1.value() = " << c01.value() << std::endl;
618 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
619 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
620 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
621 <<
" nbCreated=" << DummyTbl::nbCreated
622 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
625 trace.
beginBlock (
"ConstAlias: #DummyTbl with const DummyTbl* to const DummyTbl* member. no duplication (0/0)" );
626 ConstAliasToConstPtrMember c11( ptr_a2 );
627 trace.
info() <<
"D: d1.value() = " << c11.value() << std::endl;
628 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
629 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
630 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
631 <<
" nbCreated=" << DummyTbl::nbCreated
632 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
635 trace.
beginBlock (
"ConstAlias: #DummyTbl with const DummyTbl* to CountedConstPtrOrConstPtr<DummyTbl> member. No duplication (0/0)" );
636 ConstAliasToCountedConstPtrOrConstPtrMember c17( ptr_a2 );
637 trace.
info() <<
"D: d1.value() = " << c17.value() << std::endl;
638 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
639 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
640 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
641 <<
" nbCreated=" << DummyTbl::nbCreated
642 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
645 trace.
beginBlock (
"ConstAlias: #DummyTbl with const DummyTbl& to CountedConstPtrOrConstPtr<DummyTbl> member. No duplication (0/0)" );
646 ConstAliasToCountedConstPtrOrConstPtrMember c07( a1 );
647 trace.
info() <<
"D: d1.value() = " << c07.value() << std::endl;
648 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
649 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
650 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
651 <<
" nbCreated=" << DummyTbl::nbCreated
652 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
655 trace.
beginBlock (
"ConstAlias: #DummyTbl with CountedPtr<DummyTbl> to CountedConstPtrOrConstPtr<DummyTbl> member. No duplication (0/0)" );
656 ConstAliasToCountedConstPtrOrConstPtrMember c37( counted_a1 );
657 trace.
info() <<
"D: d1.value() = " << c37.value() << std::endl;
658 ++nb; nbok += DummyTbl::nbCreated==0 ? 1 : 0;
659 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
660 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
661 <<
" nbCreated=" << DummyTbl::nbCreated
662 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
696 unsigned int nbok = 0;
697 DummyTbl a1( 50, 10 );
704 trace.
beginBlock (
"Clone: #DummyTbl with (const DummyTbl &) to DummyTbl member. Duplication (+1/0)" );
705 CloneToValueMember c00( a1 );
706 trace.
info() <<
"D: d1.value() = " << c00.value() << std::endl;
707 ++nb; nbok += DummyTbl::nbCreated==1 ? 1 : 0;
708 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
709 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
710 <<
" nbCreated=" << DummyTbl::nbCreated
711 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
714 trace.
beginBlock (
"Clone: #DummyTbl with (CountedPtr<DummyTbl>) to DummyTbl member. Duplication (+1/0)" );
715 CloneToValueMember c30( a1 );
716 trace.
info() <<
"D: d1.value() = " << c30.value() << std::endl;
717 ++nb; nbok += DummyTbl::nbCreated==2 ? 1 : 0;
718 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
719 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
720 <<
" nbCreated=" << DummyTbl::nbCreated
721 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
724 trace.
beginBlock (
"Clone: #DummyTbl with (const DummyTbl &) to CountedPtr<DummyTbl> member. Duplication (+1/0)" );
725 CloneToCountedMember c03( a1 );
726 trace.
info() <<
"D: d1.value() = " << c03.value() << std::endl;
727 ++nb; nbok += DummyTbl::nbCreated==3 ? 1 : 0;
728 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
729 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
730 <<
" nbCreated=" << DummyTbl::nbCreated
731 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
734 trace.
beginBlock (
"Clone: #DummyTbl with (const DummyTbl &) to CowPtr<DummyTbl> member. Duplication (+1/0)" );
735 CloneToCowMember c02( a1 );
736 trace.
info() <<
"D: d1.value() = " << c02.value() << std::endl;
737 ++nb; nbok += DummyTbl::nbCreated==4 ? 1 : 0;
738 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
739 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
740 <<
" nbCreated=" << DummyTbl::nbCreated
741 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
744 trace.
beginBlock (
"Clone: #DummyTbl with (CowPtr<DummyTbl> &) to CowPtr<DummyTbl> member. Lazy duplication (0/0)" );
745 CloneToCowMember c22( cow_a1 );
746 trace.
info() <<
"D: d1.value() = " << c22.value() << std::endl;
747 ++nb; nbok += DummyTbl::nbCreated==4 ? 1 : 0;
748 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
749 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
750 <<
" nbCreated=" << DummyTbl::nbCreated
751 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
753 trace.
info() <<
"D: d1.setValue( 17 ) -> now duplicating " << std::endl;
754 trace.
info() <<
"D: d1.value() = " << c22.value() << std::endl;
755 ++nb; nbok += DummyTbl::nbCreated==5 ? 1 : 0;
756 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
757 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
758 <<
" nbCreated=" << DummyTbl::nbCreated
759 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
762 trace.
beginBlock (
"Clone: #DummyTbl with (CountedPtr<DummyTbl> &) to CowPtr<DummyTbl> member. Lazy duplication (0/0)" );
763 CloneToCowMember c32( counted_a1 );
764 trace.
info() <<
"D: d1.value() = " << c32.value() << std::endl;
765 ++nb; nbok += DummyTbl::nbCreated==5 ? 1 : 0;
766 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
767 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
768 <<
" nbCreated=" << DummyTbl::nbCreated
769 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
771 trace.
info() <<
"D: d1.setValue( 21 ) -> now duplicating " << std::endl;
772 trace.
info() <<
"D: d1.value() = " << c32.value() << std::endl;
773 ++nb; nbok += DummyTbl::nbCreated==6 ? 1 : 0;
774 ++nb; nbok += DummyTbl::nbDeleted==0 ? 1 : 0;
775 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
776 <<
" nbCreated=" << DummyTbl::nbCreated
777 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
780 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl*) to DummyTbl member. Acquisition, duplication, delete (+2/+1)" );
781 CloneToValueMember c10(
new DummyTbl( 50, 2 ) );
782 trace.
info() <<
"D: d1.value() = " << c10.value() << std::endl;
783 ++nb; nbok += DummyTbl::nbCreated==8 ? 1 : 0;
784 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
785 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
786 <<
" nbCreated=" << DummyTbl::nbCreated
787 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
790 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl*) to CowPtr<DummyTbl> member. Acquisition, no duplication (+1/0)" );
791 CloneToCowMember c12(
new DummyTbl( 50, 15 ) );
792 trace.
info() <<
"D: d1.value() = " << c12.value() << std::endl;
793 ++nb; nbok += DummyTbl::nbCreated==9 ? 1 : 0;
794 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
795 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
796 <<
" nbCreated=" << DummyTbl::nbCreated
797 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
800 trace.
beginBlock (
"Clone: #DummyTbl with (const DummyTbl&) to DummyTbl* member. Duplication (+1/0)" );
801 CloneToPtrMember c01( a1 );
802 trace.
info() <<
"D: d1.value() = " << c01.value() << std::endl;
803 ++nb; nbok += DummyTbl::nbCreated==10 ? 1 : 0;
804 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
805 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
806 <<
" nbCreated=" << DummyTbl::nbCreated
807 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
810 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl*) to DummyTbl* member. Acquisition (+1/0)" );
811 CloneToPtrMember c11(
new DummyTbl( 50, 42 ) );
812 trace.
info() <<
"D: d1.value() = " << c11.value() << std::endl;
813 ++nb; nbok += DummyTbl::nbCreated==11 ? 1 : 0;
814 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
815 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
816 <<
" nbCreated=" << DummyTbl::nbCreated
817 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
820 trace.
beginBlock (
"Clone: #DummyTbl with (CowPtr<DummyTbl>) to DummyTbl* member. Duplication (+1/0)" );
821 CloneToPtrMember c21( cow_a1 );
822 trace.
info() <<
"D: d1.value() = " << c21.value() << std::endl;
823 ++nb; nbok += DummyTbl::nbCreated==12 ? 1 : 0;
824 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
825 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
826 <<
" nbCreated=" << DummyTbl::nbCreated
827 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
830 trace.
beginBlock (
"Clone: #DummyTbl with (CountedPtr<DummyTbl>) to DummyTbl* member. Duplication (+1/0)" );
831 CloneToPtrMember c31( counted_a1 );
832 trace.
info() <<
"D: d1.value() = " << c31.value() << std::endl;
833 ++nb; nbok += DummyTbl::nbCreated==13 ? 1 : 0;
834 ++nb; nbok += DummyTbl::nbDeleted==1 ? 1 : 0;
835 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
836 <<
" nbCreated=" << DummyTbl::nbCreated
837 <<
" nbDeleted=" << DummyTbl::nbDeleted << std::endl;
840 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl &&) to DummyTbl member. Duplication by move (+2/+1/+1)" );
841 CloneToValueMember c40( DummyTbl( 50, -4 ) );
842 trace.
info() <<
"D: d1.value() = " << c40.value() << std::endl;
843 ++nb; nbok += DummyTbl::nbCreated==15 ? 1 : 0;
844 ++nb; nbok += DummyTbl::nbDeleted==2 ? 1 : 0;
845 ++nb; nbok += DummyTbl::nbMoved==1 ? 1 : 0;
846 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
847 <<
" nbCreated=" << DummyTbl::nbCreated
848 <<
" nbDeleted=" << DummyTbl::nbDeleted
849 <<
" nbMoved=" << DummyTbl::nbMoved
853 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl &&) to CowPtr<DummyTbl> member. Duplication by move (+2/+1/+1)" );
854 CloneToCowMember c42( DummyTbl( 50, -9 ) );
855 trace.
info() <<
"D: d1.value() = " << c42.value() << std::endl;
856 ++nb; nbok += DummyTbl::nbCreated==17 ? 1 : 0;
857 ++nb; nbok += DummyTbl::nbDeleted==3 ? 1 : 0;
858 ++nb; nbok += DummyTbl::nbMoved==2 ? 1 : 0;
859 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
860 <<
" nbCreated=" << DummyTbl::nbCreated
861 <<
" nbDeleted=" << DummyTbl::nbDeleted
862 <<
" nbMoved=" << DummyTbl::nbMoved
866 trace.
beginBlock (
"Clone: #DummyTbl with (DummyTbl &&) to DummyTbl* member. Duplication by move (+2/+1/+1)" );
867 CloneToCowMember c41( DummyTbl( 50, -12 ) );
868 trace.
info() <<
"D: d1.value() = " << c41.value() << std::endl;
869 ++nb; nbok += DummyTbl::nbCreated==19 ? 1 : 0;
870 ++nb; nbok += DummyTbl::nbDeleted==4 ? 1 : 0;
871 ++nb; nbok += DummyTbl::nbMoved==3 ? 1 : 0;
872 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
873 <<
" nbCreated=" << DummyTbl::nbCreated
874 <<
" nbDeleted=" << DummyTbl::nbDeleted
875 <<
" nbMoved=" << DummyTbl::nbMoved
887 unsigned int nbok = 0;
891 trace.
beginBlock (
"Total perimeter of triangles with by-value parameter passing." );
893 trace.
info() <<
"Perimeter is " << t1 << std::endl;
894 ++nb; nbok += Point::nbCreated == Point::nbDeleted ? 1 : 0;
895 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
896 <<
" Point nbCreated=" << Point::nbCreated
897 <<
" nbDeleted=" << Point::nbDeleted << std::endl;
898 int nbC = Point::nbCreated;
901 trace.
beginBlock (
"Total perimeter of triangles with by-const reference parameter passing." );
903 trace.
info() <<
"Perimeter is " << t2 << std::endl;
904 ++nb; nbok += Point::nbCreated == Point::nbDeleted ? 1 : 0;
905 ++nb; nbok += Point::nbCreated < nbC ? 1 : 0;
906 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
907 <<
" Point nbCreated=" << Point::nbCreated
908 <<
" nbDeleted=" << Point::nbDeleted << std::endl;
911 trace.
beginBlock (
"Total perimeter of triangles with by Clone parameter passing." );
913 trace.
info() <<
"Perimeter is " << t4 << std::endl;
914 ++nb; nbok += Point::nbCreated == Point::nbDeleted ? 1 : 0;
915 ++nb; nbok += Point::nbCreated < nbC ? 1 : 0;
916 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
917 <<
" Point nbCreated=" << Point::nbCreated
918 <<
" nbDeleted=" << Point::nbDeleted << std::endl;
921 trace.
beginBlock (
"Total perimeter of triangles with by CloneAndCow parameter passing." );
923 trace.
info() <<
"Perimeter is " << t5 << std::endl;
924 ++nb; nbok += Point::nbCreated == Point::nbDeleted ? 1 : 0;
925 ++nb; nbok += Point::nbCreated < nbC ? 1 : 0;
926 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
927 <<
" Point nbCreated=" << Point::nbCreated
928 <<
" nbDeleted=" << Point::nbDeleted << std::endl;
931 trace.
beginBlock (
"Total perimeter of triangles with CowPtr by CloneAndCow parameter passing." );
933 trace.
info() <<
"Perimeter is " << t6 << std::endl;
934 ++nb; nbok += Point::nbCreated == Point::nbDeleted ? 1 : 0;
935 ++nb; nbok += Point::nbCreated < nbC ? 1 : 0;
936 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")"
937 <<
" Point nbCreated=" << Point::nbCreated
938 <<
" nbDeleted=" << Point::nbDeleted << std::endl;