Changeset 3082 for trunk/yat/utility/stl_utility.h
 Timestamp:
 Sep 19, 2013, 1:54:15 AM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/utility/stl_utility.h
r2964 r3082 159 159  \c H::result_type is convertible to \c F::second_argument_type 160 160 161 \see compose_f_gxy and compose_f_gx161 \see compose_f_gxy, compose_f_gx, and compose_f_gx_hx 162 162 */ 163 163 template<class F, class G, class H> … … 235 235  \c G::result_type is convertible to \c F::argument_type 236 236 237 \see compose_f_gx_hy and compose_f_gx237 \see compose_f_gx_hy, compose_f_gx, and compose_f_gx_hx 238 238 239 239 \since New in yat 0.7 … … 310 310  \c G::result_type is convertible to \c F::argument_type 311 311 312 \see compose_f_gx_hy and compose_f_gxy 312 \see compose_f_gx_hy, compose_f_gxy, and compose_f_gx_hx 313 314 \see <a href="http://www.sgi.com/tech/stl/unary_compose.html"> 315 unary_compose</a> (SGI extension) 313 316 314 317 \since New in yat 0.7 … … 322 325 \brief default constructor 323 326 324 Requires that F and Hhave default constructors327 Requires that F and G have default constructors 325 328 */ 326 329 compose_f_gx(void) {} … … 363 366 { 364 367 return compose_f_gx<F,G>(f,g); 368 } 369 370 371 /** 372 If f is a binary functor, g and h a unary functors, and return 373 types of g and h are convertible to F's argument type, then 374 compose_f_gx_hx can be used to create a functor equivalent to \f$ 375 f(g(x), h(x)) \f$ 376 377  F must be an <a 378 href="http://www.sgi.com/tech/stl/AdaptableBinaryFunction.html"> 379 AdaptableBinaryFunction</a> 380  G must be an <a 381 href="http://www.sgi.com/tech/stl/AdaptableUnaryFunction.html"> 382 AdaptableUnaryFunction</a> 383  H must be an <a 384 href="http://www.sgi.com/tech/stl/AdaptableUnaryFunction.html"> 385 AdaptableUnaryFunction</a> 386  \c G::result_type is convertible to \c F::first_argument_type 387  \c H::result_type is convertible to \c F::second_argument_type 388 389 \see compose_f_gx_hy, compose_f_gxy, and compose_f_gx 390 391 \see <a href="http://www.sgi.com/tech/stl/binary_compose.html"> 392 binary_compose</a> (SGI extension) 393 394 \since New in yat 0.11 395 */ 396 template<class F, class G, class H> 397 class compose_f_gx_hx : public std::unary_function<typename G::argument_type, 398 typename F::result_type> 399 { 400 public: 401 /** 402 \brief default constructor 403 404 Requires that F, G, and H have default constructors 405 */ 406 compose_f_gx_hx(void) {} 407 408 /** 409 \brief Constructor 410 */ 411 compose_f_gx_hx(F f, G g, H h) 412 : f_(f), g_(g), h_(h) 413 { 414 BOOST_CONCEPT_ASSERT((boost::Convertible<typename G::result_type 415 , typename F::first_argument_type>)); 416 BOOST_CONCEPT_ASSERT((boost::Convertible<typename H::result_type 417 , typename F::second_argument_type>)); 418 } 419 420 /** 421 \brief Does the work 422 */ 423 typename F::result_type 424 operator()(typename G::argument_type x) const 425 { 426 return f_(g_(x), h_(x)); 427 } 428 429 private: 430 F f_; 431 G g_; 432 H h_; 433 }; 434 435 /** 436 Convenient function to create a compose_f_gx_hx. 437 438 \relates compose_f_gx_hx 439 440 \see std::make_pair 441 442 \since New in yat 0.11 443 */ 444 template<class F, class G, class H> 445 compose_f_gx_hx<F, G, H> make_compose_f_gx_hx(F f, G g, H h) 446 { 447 return compose_f_gx_hx<F,G,H>(f,g,h); 365 448 } 366 449
Note: See TracChangeset
for help on using the changeset viewer.