由买买提看人间百态

topics

全部话题 - 话题: function
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
T*******x
发帖数: 8565
1
来自主题: Programming版 - functional programming的两个方面
stack overflow 上的这个解说挺好。
https://stackoverflow.com/questions/24279/functional-programming-and-non-
functional-programming
There are two different definitions of "functional programming" in common
use today:
The older definition (originating from Lisp) is that functional programming
is about programming using first-class functions, i.e. where functions are
treated like any other value so you can pass functions as arguments to other
functions and function can return functions among their return va... 阅读全帖
k*******d
发帖数: 1340
2
来自主题: Programming版 - 基础问题:在header里面define function
我知道一般情况下都是在header里面declare function, 在cpp里面define
function,inline function 和 function template要放在header里面。
不过我最近写一个程序,把class definition以及member function的definition都放在
header里面,有一些member function不是function template ,有一些是function
template,结果link的时候出现错误,说那些不是function template的function "already
defined in"某另外一个obj文件,这个情况是在我一个project(VC 2008)里面有多个cpp文件的
时候出现的。刚写完这个class的时候我用了个简短的测试程序,那时候整个project还只有一个cpp
文件,就没有出现这个错误。而我把这些member function definition移到cpp文件里面去link
的错误就没了。
另外,在另一个header里面我还定义了个non-membe
c**********e
发帖数: 2007
3
【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: C++ Q89: function template and overloading
发信站: BBS 未名空间站 (Fri Oct 14 19:45:23 2011, 美东)
What range of functions does a single function template define?
A. Related overloaded functions called function templates
B. Related overloaded functions called template functions
C. Unrelated overloaded functions called function template
D. Unrelated overloaded functions called template functions
m**i
发帖数: 47
4
Job Title: Functional Excellence Manager
Department: Quality & FE, Global Operations
Report to: Sr. Quality & FE Manager, Greater China
Job Location: Yi zhuang, Beijing or Shanghai
Job Responsibilities:
1. Coordinate and drive effort across China: standardization of approach,
and of operating mechanisms (e.g., Lean metrics, project tracking mechanisms
, project prioritization and resource allocation models). The objective is
to drive a high level of visibility and accountability around Functiona... 阅读全帖
c**********e
发帖数: 2007
5
来自主题: JobHunting版 - C++ Q89: function template and overloading
What range of functions does a single function template define?
A. Related overloaded functions called function templates
B. Related overloaded functions called template functions
C. Unrelated overloaded functions called function template
D. Unrelated overloaded functions called template functions
w***g
发帖数: 5958
6
callback function一般使用function pointer实现的。C++里的functor就是包装了的f
unction pointer。function pointer除了用来callback,还可以用来干别的,比如多态
在不少语言里就是通过function pointer实现的,比如C++里的virtual function本质上
就是function pointer,C虽然不直接支持多态,但是用function pointer可以模拟。
t****a
发帖数: 1212
7
来自主题: Programming版 - functional programming?
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
my point is that in a few cases you do need to operate on functions, all
languages have such features: C has function pointers, java has anonymous
inner classes, python has lambda. it's just that they do not openly
advertise them as "functional".
FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写... 阅读全帖
t****a
发帖数: 1212
8
来自主题: Programming版 - functional programming?
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
好问题,但也许你尝试用FP语言做一做事情,亲身体验一下,会有不同的感觉。
my point is that in a few cases you do need to operate on functions, all
languages have such features: C has function pointers, java has anonymous
inner classes, python has lambda. it's just that they do not openly
advertise them as "functional".
FP和上述冯诺依曼机式语言有好些地方不一样。最主要之一是immutable的数据结构。
个人的体会是它使得写程序减少了变量,强迫程序员用类似数学推理的方式写... 阅读全帖
y****n
发帖数: 15
9
来自主题: Programming版 - 请教一个关于std::function的问题
请大牛们帮忙看看这段代码,在编译的时候会有如下error message 请问如何能编译通
过啊?跪谢!
当然这只是个虚构的例子,主要是想在template存在的情况下,传递一个member
function的指针给另一个member function.
test1.cpp: In member function 'void Foo::testInt()':
test1.cpp:30:61: error: no matching function for call to 'Foo::processVector
(std::vector&, std::_Bind_helper std::_Placeholder<1>&>::type)'
processVector(arr, std::bind(&Foo::print, this, _1));
^
test1.c... 阅读全帖
d****n
发帖数: 1637
10
var origCall = Function.prototype.call;
Function.prototype.call = function (thisArg) {
console.log("calling a function");
var args = Array.prototype.slice.call(arguments, 1);
origCall.apply(thisArg, args);
};
js自带的魔法, 得益于global object design
var origCall = Function.prototype.call;
Function.prototype.call = function (thisArg) {
console.log("calling a function");
var args = Array.prototype.slice.call(arguments, 1);
origCall.apply(thisArg, args);
};
http://stackoverflow.com/... 阅读全帖
t****t
发帖数: 6806
11
void (*A)(int): declare A as [pointer to function that takes int as
parameter, with no return]
void (*A(....))(int): declare A as a function that returns [pointer to
function that takes int as parameter, with no return], taking whatever
parameter (...)
replace "..." with "int signo, void (*func)(int)", you get what it means:
declare signal as a function, that returns [pointer to function that takes
int as parameter, with no return], and takes two parameter: first is int,
second is [pointer to fu... 阅读全帖
c******n
发帖数: 4965
12
来自主题: Programming版 - functional programming?
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
my point is that in a few cases you do need to operate on functions, all
languages have such features: C has function pointers, java has anonymous
inner classes, python has lambda. it's just that they do not openly
advertise them as "functional".
but even clojure itself does not recommend using non-named functions
recursive, but isn't operating on functions th... 阅读全帖
c******n
发帖数: 4965
13
来自主题: Programming版 - functional programming?
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
my point is that in a few cases you do need to operate on functions, all
languages have such features: C has function pointers, java has anonymous
inner classes, python has lambda. it's just that they do not openly
advertise them as "functional".
but even clojure itself does not recommend using non-named functions
recursive, but isn't operating on functions th... 阅读全帖
d*******e
发帖数: 4
14
Please polish your English. See parentheses below for corrections and
suggestions. Corrected those that are blatantly wrong. However, most non-
idiomatic usages are left untouched.
I don't really see the point of using functional programming languages for
real production projects, though clojure is very popular now.
my point is that in a few cases (WHERE) you do need to operate on functions,
all
languages have such features: C has function pointers, java has anonymous
inner classes, python has ... 阅读全帖
b*****n
发帖数: 78
15
来自主题: Mathematics版 - Bessel function 一问
可能原来的题目说的不够直观性。这样说会好些。
函数f(\bar{r})在3维空间中所有点\bar{r}的值已知,比方说此函数的contour可以画
出来。另外,又从其他途径知道此函数可以表示成Bessel function的某种线性叠加,
但每个Bessel function的中心点和系数待求。
比方说,如果函数f(\bar{r})的contour是一组同心球,我们可以断定只有一个Bessel
function,并且Bessel function的中心点是同心球的球心。如果给定f(\bar{r})函数
是由两个Bessel function叠加成的,给定他的contour,能不能直接从contour里看出
每个Bessel function的中心点?如果两个中心点分开得很远,问题很简单。但如果近
了呢?
从数学上能不能有什么解析的方法找到这些Bessel function的中心点?
n**m
发帖数: 156
16
来自主题: Statistics版 - res log pseudo-likelihood function
这里我看着有点晕,是proc glimmix里的一个interaction history。这个objective
function的值应该是-2*res log pseudo_likelihood function。
objective function是应该是max log-likelihood function ->min -log-likelihood
function吧,为啥iteration里objective function越来越大了。
Iteration History
Objective
Max
Iteration Restarts Subiterations Function
Change Gradient
0 0 ... 阅读全帖
S**********e
发帖数: 1789
17
来自主题: Statistics版 - 请教一个R的问题(function)
这个问题是关于function的。
问题的第一步是先用hard code做个图表,然后写个function。
function有3个argument:
Convert the completed code to a function including the code that will plot
the graph.The first argument to the function is to be the name of the vector
containing the adjusted closing prices so that we can analyze data from any
stock without having to rewrite our function.
第一个argument把我难倒了,怎么把vector name写成argument呢? 然后怎么call这个
function呢。找不到相关的例子
请大家指教
谢谢
n*******t
发帖数: 6
18
for example:
我有两个function pointer, 分别指向两个不同function。
complie的时候,这两个function pointer就得到function地址了吗?
可以用两个function pointer之差来indicate 系统stack 是upward 还是downward吗?
FLAG的一个面试官说不可以,因为function pointer是compile time 得到地址的。
stack 是runtime形成的。
然后把我往网上上的一个很popular的解法上引导。
但是网上所有关于这个解法的讨论都说,是因为compiler 优化造成compile time 的地
址和stack 无关。 这样,不是把gcc 的优化去掉,或者标成volatile不就可以了吗?
再问一个base class 和 相应 derived class的memory layout 能说明stack grow
direction 吗?
面试官也说不行。说,就是扯上virtual inheritance, 也是compile stage的。
m**********t
发帖数: 385
19
Consumer Lifestyle - (Senior) Function Development Engineer
Organization Description:
Philips Consumer Lifestyle provides a wide spectrum of solutions to meet the needs of consumers in health and well-being.Business Group Domestic Appliances (BG DA) plays primarily in Home Living,one of the four value spaces. At the moment BG DA consists of 5 categories:Floor care,Garment care, Beverage Appliances, Kitchen appliances and Water&Air. We also have Saeco in our portfolio. Business Group Personal Ca... 阅读全帖
m**********t
发帖数: 385
20
来自主题: JobMarket版 - Function Development Engineer Air
JOB DESCRIPTION
Position
Function Development Engineer Air
Work Location
Based in Shanghai
Roles & Responsibilities
You will be responsible for the pre-development and realization of innovative products and/or new functions in projects:
• You develop new and optimize existing product concepts within cross-functional teams.
• You scout technologies and assess the feasibility of applications. You give input in the creation of roadmaps for future product platforms.
• You act... 阅读全帖
h*****l
发帖数: 184
21
【 以下文字转载自 shopping 讨论区,原文如下 】
发信人: hanibal (汉尼拔), 信区: shopping
标 题: ASP的script function里, 可以query database吗?
发信站: The unknown SPACE (Sun Jul 28 20:54:44 2002) WWW-POST
比如我要做的工作是, 当人们选了state以后, 后面county选项的下拉选单就自动列出
该州的所有county供选择.
一般这种cascading的选择, 都是用function, function里面用array列出所有选项. 可我
的项目显然不能够让所有的州的county都列在function里, 而是应该储存在数据库里. 应
该把选择的州作为参数, 送给function, 让function去query database, 在把county
array返回.
可是我们可以在vbscript或javascript里建立数据库连接, query database 吗?
谁能指点一二, 谢谢了.
h********n
发帖数: 1671
22
来自主题: Programming版 - inline function是否可以递归?
hide definition是无关的问题,想hide definition的话,连模板都不能用,也不能有
带私有成员的类,那就干脆只用C算了。
.cpp与free function也无关。如果一段code在许多function里会用到,很自然写成一
个在.cpp中的free function,用inline、static、namespace{}都可以。
在编译器还很弱的时代,有的书上讲尽量减少函数调用,尽可能在一个函数里干所有事
,尽可能用宏代替函数调用,这种情况现在基本不存在了。相反,现在为了提高可读性
,最好不要写特别长的函数,最好用inline function(包括使用模板的inline
function)代替宏。

function
G***l
发帖数: 355
23
来自主题: Programming版 - 抛砖引玉,来谈谈functional programming
Functional Programming这几年来越来越热。 最近几年FP开始流行。众多纯FP或者FP
为主的语言出现,比如haskell, clojure, ocaml, f#等等。 很多非FP的语言都不约而
同的加入一定的FP功能,C#,C++,Java(将要)。很多一定程度支持FP的比如Python,
Ruby之类也很流行。
FP好用吗?答案是肯定的。Emacs和它所有的插件都是lisp写的,Emacs多牛逼这里就不
多说了。工业界的例子,华尔街著名的高频交易公司Jane Stree Capital的系统就是
OCaml写的,这种系统不管是的复杂性,可扩展性还是,可靠性和性能要求都是很高的。
FP的优点在哪里?wiki的词条上面列了一些fp的特性和优点,我就不赘述了。下面说一
些我的个人体验。水平有限,思维比较杂乱,大家见谅。
写程序,不管是过程式,OO还是fp,说到底是还是数据和算法。过程式样的思维,你会
想到一个input,然后这个input怎么转化,操作,最后变成output。OO能让你灵活的拆
分开数据和算法并且模块化。但你只要用OO建模过,你就会发现一开始你想的就是有... 阅读全帖
G***l
发帖数: 355
24
来自主题: Programming版 - 抛砖引玉,来谈谈functional programming
Functional Programming这几年来越来越热。 最近几年FP开始流行。众多纯FP或者FP
为主的语言出现,比如haskell, clojure, ocaml, f#等等。 很多非FP的语言都不约而
同的加入一定的FP功能,C#,C++,Java(将要)。很多一定程度支持FP的比如Python,
Ruby之类也很流行。
FP好用吗?答案是肯定的。Emacs和它所有的插件都是lisp写的,Emacs多牛逼这里就不
多说了。工业界的例子,华尔街著名的高频交易公司Jane Stree Capital的系统就是
OCaml写的,这种系统不管是的复杂性,可扩展性还是,可靠性和性能要求都是很高的。
FP的优点在哪里?wiki的词条上面列了一些fp的特性和优点,我就不赘述了。下面说一
些我的个人体验。水平有限,思维比较杂乱,大家见谅。
写程序,不管是过程式,OO还是fp,说到底是还是数据和算法。过程式样的思维,你会
想到一个input,然后这个input怎么转化,操作,最后变成output。OO能让你灵活的拆
分开数据和算法并且模块化。但你只要用OO建模过,你就会发现一开始你想的就是有... 阅读全帖
g****r
发帖数: 1589
25
来自主题: Programming版 - functional programming?
Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
多人觉得这是脱裤子放屁
要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以
后我觉得也是multi paradigm语言的有点前途,比如F#和Scala这种,纯粹的
Functional Language比如haskell,我觉得很难在工... 阅读全帖
g****r
发帖数: 1589
26
来自主题: Programming版 - functional programming?
Functional Language都出来40年了,很多概念模式被其他语言也吸收了不少,比如JS
和C#里就有大量Functional的feature和用法,估计Python里应该也有不少吧
imperative语言的特点就是你告诉计算机怎么去做一件事,if..else就是告诉计算机先
比较这俩数,如果true就干这个事;functional的特点就是只告诉计算机要完成的任务
是啥,pattern matching就是定义一个函数,然后计算机来帮你分析执行;我感觉
functional的写法还是更high level、更简洁一点,当然区别可能也没那么大,所以很
多人觉得这是脱裤子放屁
要说实现都能实现,有啥不能实现的,用汇编也就是几个CMP,JNE
说来也就是你喜欢那种,那个效率高,对于某些特定的问题哪个更有优势。通用语言肯
定还是用得最广的,但通用语言也是不断的在加入Functional Programming的概念,以
后我觉得也是multi paradigm语言的有点前途,比如F#和Scala这种,纯粹的
Functional Language比如haskell,我觉得很难在工... 阅读全帖
h******y
发帖数: 1374
27
Induction of functional hepatocyte-like cells from mouse fibroblasts by
defined factors
Nature (2011) doi:10.1038/nature10116
Received 23 August 2010 Accepted 15 April 2011 Published online 11 May 2011
Affiliations
Laboratory of Molecular Cell Biology, Institute of Biochemistry and Cell
Biology, Shanghai Institutes for
Biological Sciences, Chinese Academy for Sciences, Yueyang Road 320, 200031
Shanghai, China
Pengyu Huang, Zhiying He, Shuyi Ji, Huawang Sun, Changcheng Liu, Xin Wang &
Lijian Hui
... 阅读全帖
e********I
发帖数: 693
28
来自主题: Economics版 - [合集] 关于utility function.
☆─────────────────────────────────────☆
haloman (halo) 于 (Fri May 25 15:18:38 2007) 提到:
对于每个人来说,utility function 是不一样的,这是因为每个人的目标是不一样的。
但是如果两个人的目标是一样的话,utility function 应该是一样的吧?
例如:我的目标是在60岁退休以前有1 million 的话,根据我现在的收入,是不是可以
算出rational utility function. 根据这个来投资(赌博)的话,应该是最合适的。
经济学里面有没有utility function 合理性的理论?
☆─────────────────────────────────────☆
UnameMe (家里蹲-扫地僧-树上男爵) 于 (Fri May 25 15:45:05 2007) 提到:
关于utility function合理性的理论叫做效用理论,是现代经济学的基石之一。
utility function 的主要用处是给所有可能的选择排个先后次序。比如你有
r******0
发帖数: 2753
29
你这个讨论本身是不错的。你讲的也有一定的道理。但是有的东西是已经被大家认可并在使用的。diacrylate根据你对functionality的定义或许是4;但是根据工业界和学术界的一般共识,diacrylate的functionality是2。这里是个diacrylate的data sheet,你可以自己看。
http://www.sartomer.com/wpapers/2021.pdf
wonderlich也讲了,现在被接受的共识是:数出几个functional group, functionality就是几。所以diacryalte的functionality 是2。当functionality应用到自由基反应的时候,公式和缩聚是不同的。

2
b****t
发帖数: 114
30
来自主题: Mathematics版 - help on piecewise linear functions
Hello all,
I am thinking about optimizing a piecewise linear function. Since the
explicit function form is too complicated, I only know the function form
piecewisely, i.e. a linear function for a small subset of the domain (e.g.
points in a unit d-dimensional simplex). Thus the overall function is
piecewise linear over the R^d space with integer breaking points. ( I hope I
state the problem clearly here).
The steepest descent method can be used to find the optimum of the function
here? Dose the
w*******y
发帖数: 60932
31
mwave has ASUS WL-500Gp V2 Premium V.2 (DD-WRT Compatible) 802.11b/g Multi-
Functional Wireless Router with x2 USB Plug-N-Share hard drive function and
Print Server Function:
http://www.mwave.com/mwave/SKUSearch.asp?px=DS&scriteria=AA7625 WL-500Gp V2 Premium V.2 (DD-WRT Compatible) 802.11b/g Multi-Functional Wireless Router with x2 USB Plug-N-Share hard drive function and Print Server Function
for $60 - $40 Rebate = $20 + FS + Get $3 coupon
a***e
发帖数: 27968
32
来自主题: Military版 - function跟functionality啥区别?
functionality是说function的用途的
比如量温度是function,用来看发烧了没就是functionality了

★ 发自iPhone App: ChinaWeb 1.1.5
h****n
发帖数: 4960
33
来自主题: Classified版 - [出售]Exxon mobil gift card, $[email protected]

(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
/* ]]> */
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){... 阅读全帖
h****n
发帖数: 4960
34
来自主题: FleaMarket版 - [出售]Exxon mobil gift card, $[email protected]

(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
/* ]]> */
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){... 阅读全帖
c**********e
发帖数: 2007
35
来自主题: JobHunting版 - C++ Q28: inline function
Which one of the following statements accurately expresses the disadvantages
of making a function inline?
a) Inline functions always make the program bigger.
b) Inline functions always make the program slower.
c) Inline functions always make the program bigger and slower.
d) It is not possible to take the address of an inline function.
e) It increases compile-time dependencies.
(careerchange code 7_20, please ignore)
g***j
发帖数: 1275
36
来自主题: JobHunting版 - 问一道inline function的题目
为什么不能inline virtual function 我说inline function是compile time
virtual function 是dynamically 决定的,compile time不知道实际是哪个function
,不能expand,怎么inline呢?他说我说的不对
我说靠,你说答案是什么?他说因为inline function没有地址,所以virtual table里
面不能放地址。他非说我说的不对。
大家来评评理,我说得怎么就不对了?
H********g
发帖数: 43926
37
【 以下文字转载自 Military 讨论区 】
发信人: attain79 (蒙古国海军司令), 信区: Military
标 题: Re: function跟functionality啥区别?
发信站: BBS 未名空间站 (Thu Jan 31 16:26:04 2019, 美东)
functionality= 席卷可以杀猪
function = 席卷杀猪前有时候会给猪放血
:军版知道的不超过五个
d******8
发帖数: 2191
38
方法是用setInterval函数
var i1=setInterval( function(){ clearInterval(i1);yourfunction();},10);
var i2=setInterval(function(){ clearInterval(i2);yourfunction();},10);
这样i1,i2对应的任务就是并行的。
由此类推,
var i_array=new Array();
function Parallel(func,datas){
$(datas).each(function(i,v){
i_array[i]=setInterval(function(){
clearInterval(i_array[i]);
window[func](datas[i]);
},10);
});
}
当然这里假设func函数至多接受一个参数。
B*****g
发帖数: 34098
39
你水平不够的时候不要写太复杂的function,你需要把问题分成几个部分,我建议你这
么做
FUNCTION [dbo].[isWeekend](
@date datetime
)RETURNS bit -- 1for true, 0 for false
.....
FUNCTION [dbo].[isHoliday](
@date datetime
)RETURNS bit -- 1for true, 0 for false, check table
.....
FUNCTION [dbo].[isWorkingDay](
@date datetime
)RETURNS bit -- 1for true, 0 for false
As
Begin
if isWeekend(@date ) = 1 then
return 0
else if isHoliday(@date ) = 1 then
return 0
else
return 1
End
ALTER FUNCT... 阅读全帖
g**u
发帖数: 15
40
来自主题: Programming版 - Help C++ Template function link error .
Hi,
i am learning C++ template now. I decleared serveral template functions in a
head file and implemented them in a cpp file. In main function located in
mainfile I call these template functions, but everytime I tried, there was a
link error Lni 2001. When I move the declear and implementment to mainfile and
then call them, it's fine. In another way, I changed all the template
functions to normal functions in the head file and cpp file, the program works
well. So what's the problem?
Thanks
a*****e
发帖数: 176
41
来自主题: Programming版 - How can matlab loop over functions
I am using the function fmincon. I need to supply a constraint function.
I have a bunch of constraint function to test. How can I make a loop over
these function?
I know how to loop over numbers, but do not know how to loop over function.
Thanks very much.
j********r
发帖数: 21
42
Call-back is widely used for asynchornized interaction. It's implemented by
passing a function pointer to a call. when the called operation is exceuted,
at some point, the call-back function is called to do something for the
caller.
function pointer is like a variable for functions, and a variable for values.
h*********o
发帖数: 62
43
For what I see so far, most call back functions are life cycle functions.
In other words, once you make a call to a functionality, the container/
framework/function code will provide a chance for you to know the major
events or mess up with the process. Usually they provide you a chance to
inject your own code into the process if you want to step in. Or the process
just fires the event which you can register.
b***y
发帖数: 2799
44
For base classes, it is ok to have more virtual functions because derived
classes may need to customize these functions. For concrete classes, they
may have their own nonvirtual functions that are not supposed to be
overrided.
Also, if you declare a function as virtual, it can't be a inline function.
H*M
发帖数: 1268
45
来自主题: Programming版 - about STL functor and function pointers
studying STL now and have a question.
it seems to me that:
1. in STL, if a function is expecting a functor, it is usually ok to use fun
ction pointer; even if it is not ok, you still can use ptr_fun to get an obj
ect;
2. if it is expecting a function pointer, you can not use a functor, like qs
ort.
From what I read, most STL functions are expecting functors. Who can sumariz
e which functions are expecting function pointers only(e.g. qsort)? Or where
can I find such info.? many thanks.
d****j
发帖数: 293
46
来自主题: Programming版 - C++ Function Pointer Array 的问题
Essential C++ 第二章介绍了如何使用function pointer,我试了了一下,想获取一个
定义好的function pointer array的长度,却怎么也搞不定,请指教。
具体的问题是,有5中sequence,如fibonacci序列,squared序列,等等,假设有下列5
个对应的function,输入参数为 int size,返回一个size长度的const vector;
const vector* fibon_seq(int);
const vector* lucus_seq(int);
const vector* pell_seq(int);
const vector* triang_seq(int);
const vector* square_seq(int);
再有一个从一个vector中取出第n个元素的函数,参数为pos,要取的数字的位置,elem,
引用,存储返回值,fp,第三个是function pointer,具体如下:
bool seq_elem(int pos, int& elem, co... 阅读全帖
s*****w
发帖数: 1527
47
"JavaScript has first class functions, which allows us to treat functions as
data — assign them to variables, pass them to other functions,
return them from functions, etc…"
This is totally bullshit, seems so called "functions" in Javascript are just
class objects.
l*****a
发帖数: 119
48
Cost function shouble a subset of objective/goal function. Generally,
object/goal function can be minimize or maximize. However, we only want to
minimize the cost funtion, because it's our cost.
w*******y
发帖数: 60932
49
mwave has ASUS WL-500G V2 Premium V.2 (DD-WRT Compatible) 802.11b/g Multi-
Functional Wireless Router with x2 USB Plug-N-Share hard drive function and
Print Server Function:
http://www.mwave.com/mwave/SKUSearch_v3.asp?px=DS&scriteria=AA76258
for $37 Ar + FS
Price = $57 for mclub members (Free membership) - $20 Rebate:
http://www.mwave.com/mwave/spechr/rebates/aa76258b.pdf
= $37 + FS
if you have or get a $5 review coupon you get it for $32 AR AC + FS
w*******y
发帖数: 60932
50
mwave has ASUS WL-500Gp V2 Premium V.2 (DD-WRT Compatible) 802.11b/g Multi-
Functional Wireless Router with x2 USB Plug-N-Share hard drive function and
Print Server Function:
http://www.mwave.com/mwave/skusearch_v3.asp?scriteria=AA76258
for $50 - $20 Rebate:
http://www.mwave.com/mwave/spechr/rebates/asus_wireless_august.pdf
= $30 + FS
If you have a review coupon use it to get the router for $25 Ac AR + FS
Description:
The WL-500gP V2 is able to prioritize your needs for Internet bandwidth.
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)