Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

libs/functional/overloaded_function/test/functor.cpp

Boost , ,

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

libs/functional/overloaded_function/test/functor.cpp

// Copyright (C) 2009-2012 Lorenzo Caminiti
// Distributed under the Boost Software License, Version 1.0
// (see accompanying file LICENSE_1_0.txt or a copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Home at http://www.boost.org/libs/functional/overloaded_function
#include "identity.hpp"
#include <boost/functional/overloaded_function.hpp>
#include <boost/detail/lightweight_test.hpp>
int main() {
    //[identity_calls
    BOOST_TEST(identity_s("abc") == "abc");
    BOOST_TEST(identity_i(123) == 123);
    BOOST_TEST(identity_d(1.23) == 1.23);
    //]
    //[identity_functor
    boost::overloaded_function<
          const std::string& (const std::string&)
        , int (int)
        , double (double)
    > identity(identity_s, identity_i, identity_d);
    // All calls via single `identity` function.
    BOOST_TEST(identity("abc") == "abc");
    BOOST_TEST(identity(123) == 123);
    BOOST_TEST(identity(1.23) == 1.23);
    //]
    return boost::report_errors();
}

Статья libs/functional/overloaded_function/test/functor.cpp раздела может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-20 01:56:14/0.0043230056762695/1