FData improvements
This commit is contained in:
parent
4478948bc7
commit
c1a2ef59e4
|
@ -138,7 +138,7 @@ class FDataAccess
|
||||||
// Mutator
|
// Mutator
|
||||||
template <typename T
|
template <typename T
|
||||||
, typename V>
|
, typename V>
|
||||||
void set (V& data)
|
void set (V&& data)
|
||||||
{
|
{
|
||||||
static_cast<FData<T>&>(*this).set(std::forward<V>(data));
|
static_cast<FData<T>&>(*this).set(std::forward<V>(data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,16 +349,16 @@ void FDataTest::makeFDataTest()
|
||||||
CPPUNIT_ASSERT ( n2 == 10 );
|
CPPUNIT_ASSERT ( n2 == 10 );
|
||||||
CPPUNIT_ASSERT ( data() == 10 );
|
CPPUNIT_ASSERT ( data() == 10 );
|
||||||
CPPUNIT_ASSERT ( data_pointer->get<int>() == 10 );
|
CPPUNIT_ASSERT ( data_pointer->get<int>() == 10 );
|
||||||
//data_pointer->set<int>(33);
|
data_pointer->set<int>(33);
|
||||||
//CPPUNIT_ASSERT ( data_pointer->get<int>() == 33 );
|
CPPUNIT_ASSERT ( data_pointer->get<int>() == 33 );
|
||||||
delete data_pointer;
|
delete data_pointer;
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
data_pointer = finalcut::makeFData(my_function2);
|
data_pointer = finalcut::makeFData(my_function2);
|
||||||
const auto& func = static_cast<finalcut::FData<finalcut::clean_fdata_t<long int (*) (long int)>>&>(*data_pointer).get();
|
const auto& func = static_cast<finalcut::FData<finalcut::clean_fdata_t<long int (*) (long int)>>&>(*data_pointer).get();
|
||||||
CPPUNIT_ASSERT ( func(128) == 256 );
|
CPPUNIT_ASSERT ( func(128) == 256 );
|
||||||
//data_pointer->set<long int (*) (long int)>(&my_function3);
|
data_pointer->set<long int (*) (long int)>(&my_function3);
|
||||||
//PUNIT_ASSERT ( func(128) == 384 );
|
CPPUNIT_ASSERT ( func(128) == 384 );
|
||||||
delete data_pointer;
|
delete data_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue