optimize generated binary size

This commit is contained in:
Jinhao
2016-02-19 00:49:32 +08:00
parent d3120cbf35
commit a839cf8deb
11 changed files with 68 additions and 85 deletions

View File

@@ -231,11 +231,6 @@ namespace nana
};
}
static std::function<void(arg_reference)> build_second(fn_type&& fn, void(fn_type::*)(arg_reference))
{
return std::move(fn);
}
template<typename Tfn, typename Ret>
static std::function<void(arg_reference)> build_second(Tfn&& fn, Ret(fn_type::*)()const)
{
@@ -245,11 +240,36 @@ namespace nana
};
}
static std::function<void(arg_reference)> build_second(fn_type&& fn, void(fn_type::*)(arg_reference))
{
return std::move(fn);
}
static std::function<void(arg_reference)> build_second(fn_type&& fn, void(fn_type::*)(arg_reference) const)
{
return std::move(fn);
}
static std::function<void(arg_reference)> build_second(fn_type& fn, void(fn_type::*)(arg_reference))
{
return fn;
}
static std::function<void(arg_reference)> build_second(fn_type& fn, void(fn_type::*)(arg_reference) const)
{
return fn;
}
static std::function<void(arg_reference)> build_second(const fn_type& fn, void(fn_type::*)(arg_reference))
{
return fn;
}
static std::function<void(arg_reference)> build_second(const fn_type& fn, void(fn_type::*)(arg_reference) const)
{
return fn;
}
template<typename Tfn, typename Ret, typename Arg2>
static std::function<void(arg_reference)> build_second(Tfn&& fn, Ret(fn_type::*)(Arg2))
{
@@ -259,7 +279,7 @@ namespace nana
fn(arg);
};
}
template<typename Tfn, typename Ret, typename Arg2>
static std::function<void(arg_reference)> build_second(Tfn&& fn, Ret(fn_type::*)(Arg2)const)
{

View File

@@ -15,7 +15,6 @@
#include <nana/gui/layout_utility.hpp>
#include <sstream>
#include <deque>
#include <vector>
#include <list>
@@ -86,26 +85,12 @@ namespace nana{ namespace widgets{ namespace skeletons
std::pair<unsigned, unsigned> binary_number() const
{
std::stringstream ss;
ss<<static_cast<std::string>(nana::charset(binary_.first))<<' '<<static_cast<std::string>(nana::charset(binary_.second));
std::pair<unsigned, unsigned> r;
ss>>r.first>>r.second;
return r;
return{ std::stoul(binary_.first), std::stoul(binary_.second) };
}
int number() const
{
std::stringstream ss;
ss<<static_cast<std::string>(nana::charset(idstr_));
//It's a hex number.
if(idstr_.size() > 2 && idstr_[0] == '0' && (idstr_[1] == 'x' || idstr_[1] == 'X'))
ss>>std::hex;
int n;
ss>>n;
return n;
return std::stoi(idstr_, nullptr, 0);
}
private:
static bool _m_unicode_word_breakable(wchar_t ch)