wesnoth/src/random_new_synced.hpp
Charles Dang 0ca4e6c943 Convert uses of boost functional to standard library variants
This commit converts the following function calls:

* boost::bind                          -> std::bind
* boost::function and boost::functionN -> std::function
* boost::ref and boost::cref           -> std::ref and std::cref
* boost::bad_function_call             -> std::bad_function_call

In the process, it was discovered that std::bind has trouble with overloaded
functions. There were two such cases in the code:

* gui2::twindow had an ancient unused overload to draw(). The overload was removed.
* gui2::trepeating_button was binding tdispatcher::fire. This case was converted
  to a lambda.
2016-04-04 02:20:52 +11:00

44 lines
1.1 KiB
C++

/*
Copyright (C) 2014 - 2016 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#ifndef RANDOM_NEW_SYNCED_H_INCLUDED
#define RANDOM_NEW_SYNCED_H_INCLUDED
#include "random_new.hpp"
#include "mt_rng.hpp"
#include "utils/functional.hpp"
/*
todo: use a boost::random based solution.
*/
namespace random_new
{
class synced_rng : public random_new::rng
{
public:
synced_rng(std::function<std::string()> seed_generator);
virtual ~synced_rng();
protected:
virtual uint32_t next_random_impl();
private:
void initialize();
bool has_valid_seed_;
std::function<std::string()> seed_generator_;
rand_rng::mt_rng gen_;
};
}
#endif