Changeset 800968b7 in mainline
- Timestamp:
- 2018-07-05T21:41:23Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f56e741c
- Parents:
- a30c04d
- git-author:
- Dzejrou <dzejrou@…> (2018-05-04 16:08:44)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/functional.hpp
ra30c04d r800968b7 1144 1144 }; 1145 1145 1146 template<class F, class... Args> 1147 class bind_t; 1148 1146 1149 template<class... Args> 1147 1150 class bind_arg_filter … … 1152 1155 { /* DUMMY BODY */ } 1153 1156 1154 // TODO: enable if T != ref_wrapper1155 1157 template<class T> 1156 1158 constexpr decltype(auto) operator[](T&& t) … … 1161 1163 template<int N> 1162 1164 constexpr decltype(auto) operator[](const placeholder_t<N>) 1163 { 1165 { // Since placeholders are constexpr, this is the best match for them. 1164 1166 /** 1165 1167 * Come on, it's int! Why not use -1 as not placeholder 1166 1168 * and start them at 0? -.- 1167 1169 */ 1168 /* return get<is_placeholder_v<decay_t<T>> - 1>(args_); */1169 1170 return get<N - 1>(args_); 1170 1171 } 1171 1172 1172 // TODO: overload the operator for reference_wrapper 1173 template<class T> 1174 constexpr T& operator[](reference_wrapper<T> ref) 1175 { 1176 return ref.get(); 1177 } 1178 1179 template<class F, class... BindArgs> 1180 constexpr decltype(auto) operator[](const bind_t<F, BindArgs...> b) 1181 { 1182 return b; // TODO: bind subexpressions 1183 } 1184 1173 1185 1174 1186 private: … … 1181 1193 // TODO: conditional typedefs 1182 1194 public: 1195 // TODO: T& gets captured by ref, should be by value :/ 1183 1196 template<class... BoundArgs> 1184 1197 constexpr bind_t(F&& f, BoundArgs&&... args) … … 1186 1199 bound_args_{forward<BoundArgs>(args)...} 1187 1200 { /* DUMMY BODY */ } 1201 1202 constexpr bind_t(const bind_t& other) = default; 1203 constexpr bind_t(bind_t&& other) = default; 1188 1204 1189 1205 template<class... ActualArgs>
Note:
See TracChangeset
for help on using the changeset viewer.