delivery_man.hpp
Go to the documentation of this file.
00001 #include <cstddef>
00002 #include <iostream>
00003 
00004 #ifndef __DELIVERY_MAN
00005 #define __DELIVERY_MAN
00006 
00007 class DeliveryMan
00008 {
00009 public:
00011 
00013     void DeliverPackage(std::size_t distance)
00014     {
00015         // Waste some clock cycles here.
00016         std::size_t largeNumber = 10000u * distance / _speed;
00017         volatile std::size_t targetNumber;
00018 
00019         while (largeNumber--)
00020         {
00021             targetNumber = largeNumber;
00022         }
00023     }
00024 
00025 
00027 
00029     DeliveryMan(std::size_t speed)
00030         :   _speed(speed)
00031     {
00032 
00033     }
00034 private:
00035     std::size_t _speed; 
00036 };
00037 #endif


hayai
Author(s): Nick Bruun
autogenerated on Thu Jun 6 2019 18:13:43