![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
THE BOOST MPL LIBRARY: ExercisesBoost , ,
|
Front Page / Tutorial: Metafunctions and Higher-Order Metaprogramming / Exercises |
There's still a problem with the dimensional analysis code in section 1.1. Hint: What happens when you do:
f = f + m * a;
Ремонт этого примера с использованием методов, показанных в этой главе.
What do you think would be the semantics of the following constructs:
typedef mpl::lambda<mpl::lambda<_1> >::type t1; typedef mpl::apply<_1,mpl::plus<_1,_2> >::type t2; typedef mpl::apply<_1,std::vector<int> >::type t3; typedef mpl::apply<_1,std::vector<_1> >::type t4; typedef mpl::apply<mpl::lambda<_1>,std::vector<int> >::type t5; typedef mpl::apply<mpl::lambda<_1>,std::vector<_1> >::type t6; typedef mpl::apply<mpl::lambda<_1>,mpl::plus<_1,_2> >::type t7; typedef mpl::apply<_1,mpl::lambda< mpl::plus<_1,_2> > >::type t8;
Show the steps used to arrive at your answers and write tests verifying your assumptions. Did the library behavior match your reasoning? If not, analyze the failed tests to discover the actual expression semantics. Explain why your assumptions were different, what behavior you find more coherent, and why.
Статья THE BOOST MPL LIBRARY: Exercises раздела может быть полезна для разработчиков на c++ и boost.
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.
:: Главная :: ::
реклама |