src_logger_assignable.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright Andrey Semashev 2007 - 2015.
  3. * Distributed under the Boost Software License, Version 1.0.
  4. * (See accompanying file LICENSE_1_0.txt or copy at
  5. * http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. /*!
  8. * \file src_logger_assignable.cpp
  9. * \author Andrey Semashev
  10. * \date 16.05.2011
  11. *
  12. * \brief This header contains a test for logger assignability.
  13. */
  14. #include <boost/log/sources/logger.hpp>
  15. #include <boost/log/sources/severity_logger.hpp>
  16. #include <boost/log/sources/channel_logger.hpp>
  17. #include <boost/log/sources/severity_channel_logger.hpp>
  18. template< typename LoggerT >
  19. void test()
  20. {
  21. LoggerT lg1, lg2;
  22. // Loggers must be assignable. The assignment operator must be taken
  23. // from the composite_logger class and not auto-generated (in which
  24. // case it will fail to compile because assignment in basic_logger is private).
  25. lg1 = lg2;
  26. }
  27. int main(int, char*[])
  28. {
  29. test< boost::log::sources::logger >();
  30. test< boost::log::sources::severity_logger< > >();
  31. test< boost::log::sources::channel_logger< > >();
  32. test< boost::log::sources::severity_channel_logger< > >();
  33. return 0;
  34. }