#10439 closed Bugs (fixed)
Flyweight: now the constructor is explicit
Reported by: | Owned by: | Joaquín M López Muñoz | |
---|---|---|---|
Milestone: | To Be Determined | Component: | flyweight |
Version: | Boost 1.56.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hi,
The following piece of code used to work fine, but with 1.56, it now fails to compile with the two major free compilers.
Thanks!
$ cat /tmp/foo.cc #include <string> #include <boost/flyweight.hpp> int main() { boost::flyweight<std::string> f = {}; } $ clang++-mp-3.5 -std=c++11 -I /opt/local/include foo.cc foo.cc:6:33: error: chosen constructor is explicit in copy-initialization boost::flyweight<std::string> f = {}; ^ ~~ /opt/local/include/boost/flyweight/flyweight.hpp:195:14: note: constructor declared here explicit flyweight, ^ /opt/local/include/boost/flyweight/detail/perfect_fwd.hpp:79:27: note: expanded from macro 'BOOST_FLYWEIGHT_PERFECT_FWD' template<typename... Args>name(Args&&... args) \ ^ 1 error generated. $ g++-mp-4.9 -std=c++11 -I /opt/local/include foo.cc foo.cc: In function 'int main()': foo.cc:6:38: error: converting to 'boost::flyweights::flyweight<std::basic_string<char> >' from initializer list would use explicit constructor 'boost::flyweights::flyweight<T, Arg1, Arg2, Arg3, Arg4, Arg5>::flyweight(Args&& ...) [with Args = {}; T = std::basic_string<char>; Arg1 = boost::parameter::void_; Arg2 = boost::parameter::void_; Arg3 = boost::parameter::void_; Arg4 = boost::parameter::void_; Arg5 = boost::parameter::void_]' boost::flyweight<std::string> f = {}; ^
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed at:
https://github.com/boostorg/flyweight/commit/20230d966942fa4bfddba3a2b8fea0cd26eee6d4
I'd appreciate if you could test the fix works for you.
comment:3 by , 8 years ago
Hi Joaquin,
Thanks for the quick fix. Yes, I can confirm that it fixed my issue. FWIW, I have also observe a 20% speed up of my parsing routines (from 1.55 to 1.56), that use flyweight for identifiers. Nice!
Note:
See TracTickets
for help on using tickets.
The following also used to work up to 1.55, and is now broken.