| 326 | { |
| 327 | |
| 328 | template<class R, class T> class dm |
| 329 | { |
| 330 | public: |
| 331 | |
| 332 | typedef R const & result_type; |
| 333 | typedef T const * argument_type; |
| 334 | |
| 335 | private: |
| 336 | |
| 337 | typedef R (T::*F); |
| 338 | F f_; |
| 339 | |
| 340 | template<class U> R const & call(U & u, T const *) const |
| 341 | { |
| 342 | return (u.*f_); |
| 343 | } |
| 344 | |
| 345 | template<class U> R const & call(U & u, void const *) const |
| 346 | { |
| 347 | return (get_pointer(u)->*f_); |
| 348 | } |
| 349 | |
| 350 | public: |
| 351 | |
| 352 | explicit dm(F f): f_(f) {} |
| 353 | |
| 354 | R & operator()(T * p) const |
| 355 | { |
| 356 | return (p->*f_); |
| 357 | } |
| 358 | |
| 359 | R const & operator()(T const * p) const |
| 360 | { |
| 361 | return (p->*f_); |
| 362 | } |
| 363 | |
| 364 | template<class U> R const & operator()(U const & u) const |
| 365 | { |
| 366 | return call(u, &u); |
| 367 | } |
| 368 | |
| 369 | #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200) |
| 370 | |
| 371 | R & operator()(T & t) const |
| 372 | { |
| 373 | return (t.*f_); |
| 374 | } |
| 375 | |
| 376 | R const & operator()(T const & t) const |
| 377 | { |
| 378 | return (t.*f_); |
| 379 | } |
| 380 | |
| 381 | #endif |
| 382 | |
| 383 | bool operator==(dm const & rhs) const |
| 384 | { |
| 385 | return f_ == rhs.f_; |
nothing calls this directly
no test coverage detected