ā¬†ļø ā¬‡ļø

I got redundancy C ++

image Hi Habr,

C ++ enters me into a stupor. I’m just hanging out over the monitor, looking out the window, sipping tea ... And I’m starting to feel sorry for the years spent pricelessly studying the C ++ standard, trying to write my front-end compiler. These tricky books C ++ In Depth. How indignant I was when I did not understand the code from the book Alexandrescu. How to write down all the postulates of Straustrup and their ilk. What for? Here I ask myself why I now know all this. More, I want to say that this language is merciless for a guru, not from a medical, not from an economic point of view! He does not justify the effort invested in his study - once. In practice, it is not economically beneficial - two. And nerve cells will confirm that accompanying someone else's plus code - it can be dangerous to health - three. Let there be randomly scattered metaphors, I write as is, from experience.





Here, for example, because of bizarre postulates: objects in methods to transfer as constant links.

Yes i'm writing

Status DetectionManager::GetDetectionStatus(const FileScanTask &fileTask) const {
    m_detector.GetDetectionStatus(fileTask);
}




. : , , , const, -… … m_detector mutable. … - .

? , 'm_', . ? throw ?

, …

, , - Ā« Ā».



, :

set/get . Exception reason, , , , Get, Get const, Get const volatile, ? , friend', ? , !



:

— goto. do { break; } while(0); .

— . ! .

— , . , 4- .

— . !



, , , , . … , .



:

— 4 . ? — . , .

— — . ,

, — . …

— reinterpret_cast, static_cast, const_cast. private_to_public_in_case_exception_cast?



, :

— map'. .

typedef typename _STD tr1::conditional<
        _STD tr1::is_same<key_type, value_type>::value,
        const_iterator,
        _Tree_iterator<_Mybase> >::type iterator;




— . , , — . WinApi, 2 . ! TODO . , .

template <
    typename Task                                   = task_func,
    template <typename> class SchedulingPolicy      = fifo_scheduler,
    template <typename> class SizePolicy            = static_size,
    template <typename> class SizePolicyController  = resize_controller,
    template <typename> class ShutdownPolicy        = wait_for_all_tasks
  > 
  class thread_pool




, :

rvalue- &&, constexpr, . .

.

? , . C++ 0x auto STL-, .



— !



. . .

. , . . , - . , .



. . . , ? , , , , - , , . , — .



!


')

Source: https://habr.com/ru/post/125564/



All Articles