Closed Bug 1263666 Opened 9 years ago Closed 9 years ago

Add an IsConstructible trait to MFBT

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX
Tracking Status
firefox48 --- affected

People

(Reporter: botond, Unassigned)

References

Details

C++11 has a standard type traits named |is_constructible<T, U...>| which checks whether |T| is constructible from arguments of types |U...|. MFBT doesn't currently have an equivalent of this. We should add one. For example, we need it to implement bug 1263654.
I briefly glance the g++ implementation, shall we handle all the cases that g++ implements or just handle the normal use case? It is complicated, can we just translate the g++ implementation into gecko?
(In reply to James Cheng[:JamesCheng] from comment #2) > I briefly glance the g++ implementation, > shall we handle all the cases that g++ implements or just handle the normal > use case? I'm happy with just handling the most common case for now, especially as we'll hopefully be able to drop all these type trait polyfills and start using the C++11 type traits themselves soon. > It is complicated, can we just translate the g++ implementation into gecko? We have to be careful about copying / transliterating libstdc++ code into Mozilla code, because libstdc++ is GPL-licensed and Mozilla code is not. I think borrowing the high-level design of a component (the way I did for mozilla::Tuple) is OK, and looking at how they address a particular edge case is OK, but transliterating the entire implementation of a type trait crosses a line. Libc++ is permissively licensed and thus doesn't have the same issue; we should be able to borrow from their implementation more liberally.
Now that we can use C++11 standard library facilities in our code, we can just use std::is_constructible instead of writing our own.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.