X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=blobdiff_plain;f=test%2Finclude%2Fcds_test%2Ffc_hevy_value.h;h=4159bd7f45bcb8dd980adfc61fda21548b59df53;hp=ba3fc2661978278e71910b43b944a95f3a34a5b9;hb=c9519ba382f90ce5f4e4369cf2b6ac2c57a73ff8;hpb=baf947b4f078e0fa4a5608f27fb60dc5c649030e diff --git a/test/include/cds_test/fc_hevy_value.h b/test/include/cds_test/fc_hevy_value.h index ba3fc266..4159bd7f 100644 --- a/test/include/cds_test/fc_hevy_value.h +++ b/test/include/cds_test/fc_hevy_value.h @@ -8,7 +8,7 @@ #ifndef SOURCE_DIRECTORY__TEST_INCLUDE_CDS_TEST_FC_HEAVY_VALUE_H_ #define SOURCE_DIRECTORY__TEST_INCLUDE_CDS_TEST_FC_HEAVY_VALUE_H_ -#include +#include #include namespace fc_test { @@ -16,13 +16,16 @@ namespace fc_test { // SFINAE test template class has_set_array_size { - typedef char small; - class big{char dummy[2];}; + typedef char select_small; + class select_big { + char dummy[2]; + }; - template class SFINAE {}; + template class selector + {}; - template static small test( SFINAE * ) ; - template static big test(...); + template static select_small test( selector* ) ; + template static select_big test(...); public: static constexpr bool value = sizeof(test(0)) == sizeof(char) ; @@ -43,25 +46,31 @@ namespace fc_test { : value(new_value), nNo(0), nWriterNo(0) + {}; + + heavy_value( heavy_value const& other) + : value(other.value) + , nNo(other.nNo) + , nWriterNo(other.nWriterNo) { - }; - heavy_value(const heavy_value &other) - : value(other.value), - nNo(other.nNo), - nWriterNo(other.nWriterNo) - { + // This is an imitation of heavy copy ctor for(size_t i = 0; i < buffer_size; ++i) - pop_buff[i] = static_cast(std::sqrt(other.pop_buff[i]*rand())); + pop_buff[i] = static_cast( std::sqrt( std::abs( static_cast( pop_buff[i] ) * rand()))); } - void set_array(size_t new_size) { + + void set_array(size_t new_size) + { set_array_size(new_size); } - static void set_array_size(size_t new_size){ + + static void set_array_size(size_t new_size) + { if (buffer_size == new_size) return; buffer_size = new_size; pop_buff.resize(buffer_size, rand()); } }; + template std::vector heavy_value< DefaultSize >::pop_buff(DefaultSize, rand()); template